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
SAS Super FREQ
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!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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