## How to count the number of variables with arguments?

Solved
Occasional Contributor
Posts: 17

# 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

 Year Index 2005 5 2005 8 2005 11 2006 6 2007 13 2007 5 2007 6 2007 5 2008 8 2008 5 2008 5

table 2

 2005 2006 2007 2008 Index<6 1 0 2 2 Index=6 0 1 1 0 Index=8 1 0 0 1 Index>8 1 0 1 0

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

## 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;

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

## 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
• 230 views
• 0 likes
• 2 in conversation