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 -
Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.
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.