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 |
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;
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;
thanks pal! great help!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.