Here am creating a macro here am creating two datasets x1 x2 from s1 s1 since i cud not access s1 s2 directly in proc sql
in macro,even in this way also i cud nt get the correct result,am getting error ''File WORK.RUN.DATA does not exist''
.
%macro test_(test_,s1,s2);
data x1;
set &s1
run;
data x2;
set &s2;
run;
proc sql ;
create table &test_ as
select x1.classifications, x1.VSSTRESN as Active,
x2.VSSTRESN as placebo,sum(x1.VSSTRESN,x2.VSSTRESN ) as total
from x1,x2 where x1.classifications=x2.classifications;
quit;
%mend;
even i cud nt access the data in the following way also
proc sql ;
create table &test_ as
select &s1.classifications, &s1.VSSTRESN as Active,
&s2.VSSTRESN as placebo,sum(&s1.VSSTRESN,&s2.VSSTRESN ) as total
from &s1,&s2 where &s1.classifications=&s1.classifications;
quit;
%test_(test100,r1,r2);
cup u pls help me out.
You have situations where you are referring to a macro variable, and attempting to append text after it. For example:
&s1.classifications
That's incorrect. The dot actually delimits the name of the macro variable, so where you hope to generate:
r1.classifications
You are actually generating:
r1classifications
In order to get r1.classifications, you need two dots: one to delimit the name of the macro variable, and a second dot becomes text following the macro variable value:
&s1..classifications
Writing in plain English might make it easier for non-native speakers to follow you.
Can you attach the SASLOG so we can see not just this macro but the steps before? This error sometimes is caused by a missing semicolon somewhere, but SAS is looking for a dataset named RUN and it doesn't find it.
Agreeing with @Kurt_Bremser, writing in proper English would also help.
@Reeza wrote:
And from @PaigeMiller comment your first data step is missing a semicolon.
Even though I knew that was the problem, I failed to see the missing semicolon!
You have situations where you are referring to a macro variable, and attempting to append text after it. For example:
&s1.classifications
That's incorrect. The dot actually delimits the name of the macro variable, so where you hope to generate:
r1.classifications
You are actually generating:
r1classifications
In order to get r1.classifications, you need two dots: one to delimit the name of the macro variable, and a second dot becomes text following the macro variable value:
&s1..classifications
Try this:
%macro test_(test_,s1,s2);
data x1;
set &s1; /*semi-colon was missing*/
run;
data x2;
set &s2;
run;
proc sql ;
create table &test_ as
select x1.classifications,
x1.VSSTRESN as Active,
x2.VSSTRESN as placebo,
sum(x1.VSSTRESN,x2.VSSTRESN ) as total
from x1,x2
where x1.classifications=x2.classifications;
quit;
%mend;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.