Can anyone please help me out with below code:
libname lib1 'E:\SAS Practice Starting';
Data lib1.hospital;
infile datalines dlm='~' dsd;
input patient:$10. hospitalname:$10. location:$8. amount;
datalines;
p001~lotus~hyd~3000
p002~lotus~hyd~5000
p003~rainbow~bng~2000
p004~rainbow~hyd~5000
p005~apolo~gujarat~1500
p006~apolo~gujarat~3000
p007~yasoda~mumbai~2000
p008~yasoda~mumbai~800
p009~global~hyd~5000
p0010~global~hyd~800
p002~lotus~hyd~5000
p003~rainbow~bng~2000
p005~apolo~gujarat~1500
run;
but my actual problem starts in below program i cant able to use like this '&lib.&table' but i can able to use like this 'lib1.&table'. But i want to pass both libraryname and tablename and i want to resolve together.
%macro pp(lib,table,hospitalname);
PROC SQL;
select sum(amount) as Amount,&hospitalname
from &lib.&table
/*where hospitalname='lotus'*/
group by &hospitalname;
QUIT;
%mend;
%pp(lib1,hospital,hospitalname);
%pp;
quik look tells me
from &lib.&table
should be
from &lib..&table
with two .. in between
quik look tells me
from &lib.&table
should be
from &lib..&table
with two .. in between
Thanks a lot
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.