Date: Fri, 17 Dec 1999 08:38:02 -0500
Reply-To: "King, Raymond" <raymondk@MOCR.OAPI.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "King, Raymond" <raymondk@MOCR.OAPI.COM>
Subject: Re: SAS 6.12 with OLE automation
Content-Type: text/plain; charset="iso-8859-1"
In your Strprint assignment, are your single and double quotes properly
placed?
"'c:\sas\qol\" & Trim(Str(n)) & "\list_freq_uniseq forms.txt'
Also, have you considered using the Chr(39) instead of the single quote.
Maybe VB is seeing everything after your single quote as a comment.
Good luck!
Raymond
> -----Original Message-----
> From: Thierry Gorlia [SMTP:tgo@EORTC.BE]
> Sent: Friday, December 17, 1999 8:24 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: SAS 6.12 with OLE automation
>
> Hi all,
>
> 1° I try to launch a SAS macro included in a file named "moccur.sas"
> from Access 97 through OLE automation.
>
> %macro moccur(filenm);
> %let i=1;
> %do %while(%scan(&filenm,&i) ne) ;
> %let v=%upcase(%scan(&filenm,&i));
>
> proc sort data=&v; by patid; run ;
> %gcount(data=&v) ;
> title "Occurrence of the non-sequential &v form";
> proc freq data=patient; tables c&v/missing; run;
> title "multiple occurrence of the non-sequential &v form";
> proc print data=patient; where c&v>1; var patid hospno c&v; run;
>
> data &v; set &v; by patid;
> if first.patid; /* in case of multiple occurrence of */
> /* non-sequential form, the first one is taken */
> run;
>
> data patient; merge patient &v; by patid;
> run;
>
> %let i=%eval(&i+1);
> %end;
> title ;
> %mend moccur;
>
> For doing that I have programmed the following VBA subroutine:
>
> Sub Sequentiality(ObjSAS As Object, n As Integer)
>
> Dim Strprint As String
>
> With ObjSAS
>
> .submit ("proc sort data=patient;by patid;")
> Strprint = "'c:\sas\qol\" & Trim(Str(n)) & "\list_freq_uniseq forms.txt'
> new; "
> .submit ("proc printto print=" & Strprint)
> .submit ("%moccur(filenm=formrg1 form1 form2 form3 form4);")
> .submit ("proc printto;")
> .submit ("run;")
>
> End With
>
> Of course, I have first included the moccur.sas file into the process.
>
> I receive the following error message : "One or more tokens on the
> command line were truncated."
> With the result that only one token is treated but nothing is printed
> to 'list_freq_uniseq forms.txt'
> However, this code runs properly in the SAS environment without
> truncating tokens.
> What does it happen ? What did I wrong ?
>
> 2° Does somebody know where I can find some good addresses about the SAS
> system and Ole Automation or Object Oriented Programming.
>
>
> Thanks for your help
>
> Thierry Gorlia
> Statistician
> European Organisation for Research and Treatment of Cancer
|