Hi, could you please help me with this?
i should Create macro variable that will be used to filter the dataset BASEBALL to keep observation where player’s Surname isn’t starting with “W” letter.
Create a macro program to count how many players are playing –
%let whereCond=%str(where name^=:'W');
DATA test;
set sashelp.baseball;
&whereCond.;
RUN;
%MACRO countPlayers(inputDS=,var1=,var2=);
proc freq data=&inputDS.;
table &var1.*&var2. /norow nocol nopercent;
run;
%MEND countPlayers;
%countPlayers(inputDS=test,var1=div,var2=team);
%countPlayers(inputDS=test,var1=league,var2=position);
- Cheers -
What have you tried so far?
I start with this code and stopped because i don't know what to do, could you please help me?
data base;
set sashelp.baseball;
run;
%let name=basename;
data &name.123;
base=3;
run;
%let whereCond=%str(where name^=:'W');
DATA test;
set sashelp.baseball;
&whereCond.;
RUN;
%MACRO countPlayers(inputDS=,var1=,var2=);
proc freq data=&inputDS.;
table &var1.*&var2. /norow nocol nopercent;
run;
%MEND countPlayers;
%countPlayers(inputDS=test,var1=div,var2=team);
%countPlayers(inputDS=test,var1=league,var2=position);
- Cheers -
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.