☑ This topic is solved.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 04-20-2023 02:58 AM
(1076 views)
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 –
- in the same DIV and in the same TEAM,
- in the same LEAGUE and at the same POSITION.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
%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 -
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What have you tried so far?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
%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 -