DATA Step, Macro, Functions and more

How to count the number of variables with arguments?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

How to count the number of variables with arguments?

Hi, new user here that is trying to learn the ropes. I have a question here, how do I convert table 1 to table 2? table 2 is to calculate the frequency of eg, number of times in year 2005, 2006.. where the index is 6.

table 1

YearIndex
20055
20058
200511
20066
200713
20075
20076
20075
20088
20085
20085

table 2

2005200620072008
Index<61022
Index=60110
Index=81001
Index>81010

Accepted Solutions
Solution
‎04-05-2015 01:45 PM
Trusted Advisor
Posts: 1,228

Re: How to count the number of variables with arguments?

proc format;

value indx low-5='Index<6'

               6='Index=6'

               8='Index=8'

              8-high='Index>8';

run;

proc freq data=table1;

table index*year/nocum nopercent norow nocol;

format index indx.;

run;

View solution in original post


All Replies
Solution
‎04-05-2015 01:45 PM
Trusted Advisor
Posts: 1,228

Re: How to count the number of variables with arguments?

proc format;

value indx low-5='Index<6'

               6='Index=6'

               8='Index=8'

              8-high='Index>8';

run;

proc freq data=table1;

table index*year/nocum nopercent norow nocol;

format index indx.;

run;

Occasional Contributor
Posts: 17

Re: How to count the number of variables with arguments?

thanks pal! great help!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 212 views
  • 0 likes
  • 2 in conversation