BookmarkSubscribeRSS Feed
stateworker
Fluorite | Level 6
Hi. I know there has to be a way to do this, but I haven't done a lot of output beyond basic freqs or proc-prints. Here's what my data looks like:

County Year E P %
01-A 1989 1225 4317 28.376
01-A 1990 383 3812 10.047
01-A 1991 386 3537 10.913
01-A 1992 414 3510 11.795
01-A 1993 438 3653 11.99
01-A 1994 458 3851 11.893
02-B 1989 85 220 38.636
02-B 1990 93 252 36.905
02-B 1991 92 312 29.487
02-B 1992 84 278 30.216
02-B 1993 122 189 64.55
02-B 1994 81 174 46.552

And here is how I need it to output:

County Year
1989 1990 1991 etc.
E P % E P % E P % etc.
01A 1225 4317 28 383 3812 10 386 3537 10 etc.
02B 85 220 38 93 252 36 92 312 29 etc.

How can I do it? Or am I stuck with manipulating it greatly in Excel?

Thanks so much.

Sign me ~ novice outputter
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
If your data were called WORK.YRDATA and your variables were actually named:
COUNTY, YEAR, E, P and PCTVAL (since % is an invalid variable name)

then you could generate the desired report with PROC REPORT. (I put an RBREAK statement, but if you don't want report totals, then you can simply delete that statement.

cynthia

[pre]
ods html file='c:\temp\across_examp.html' style=sasweb;

proc report data=yrdata nowd;
column county year,(e p pctval);
define county / group 'County';
define year / across 'Year';
define e / 'E';
define p / 'P';
define pctval / '%' f=3.0;
rbreak after / summarize;
run;
ods html close;
[/pre]
stateworker
Fluorite | Level 6
Cynthia -

Thanks so much! It worked beautifully.
stateworker
Fluorite | Level 6
So I just have to say that I had to do this again and it was great to come back here to refresh!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1121 views
  • 0 likes
  • 2 in conversation