BookmarkSubscribeRSS Feed
bheinsius
Lapis Lazuli | Level 10
Hi,

There was another post on this forum concerning this problem but I didn't get the info from it that I wanted, so I try again. 🙂

See the result of the following code:
[PRE]
proc report data=sashelp.class nowindows;
columns age sex,(name height);
define age /group;
define sex /across;
define name /display;
define height / analysis;
run;
[/PRE]

[PRE]
Sex
F M
Age Name Height Name Height
11 Joyce 51.3 Thomas 57.5
12 Jane 59.8 .
Louise 56.3 James 57.3
. John 59
. Robert 64.8
13 Alice 56.5 .
Barbara 65.3 Jeffrey 62.5
14 Carol 62.8 .
Judy 64.3 Alfred 69
. Henry 63.5
15 Janet 62.5 .
Mary 66.5 Ronald 67
. William 66.5
16 . Philip 72
[/PRE]

Why is proc report skipping the lines? And what is the algorithm?

The result I'm looking for is like this but with the empty cells shifted up per AGE.

-Bart

Message was edited by: bheinsius

Message was edited by: bheinsius Added code results


Message was edited by: bheinsius
7 REPLIES 7
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
If you are sharing your SAS code (it's unclear, at least to me), suggest you also share a sample of "See the result of the following code". You can easily paste an example (or code one up) in your reply.

Scott Barry
SBBWorks, Inc.
Flip
Fluorite | Level 6
This has always been one of my pet peaves about proc report. It cannot roll up values unless they are numeric and you use a sum etc.
data_null__
Jade | Level 19
You will have to roll your own.

[pre]
proc sort data=sashelp.class out=class;
by age sex name;
run;
data class;
set class;
by age sex name;
if first.sex then index=0;
index + 1;
run;
proc report data=class list nowindows;
columns age index sex,(name height);
define age / group;
define index / group noprint;
define sex / across;
define name / display;
define height / sum;
break after age / skip;
run;
[/pre]
bheinsius
Lapis Lazuli | Level 10
That's a great solution for me data _null_, thanks!
-Bart
bheinsius
Lapis Lazuli | Level 10
I tried pasting the results of my code but formatting was messed up.
How can I do that?

-Bart
data_null__
Jade | Level 19
[pre]
left square bracket pre right square bracket
left square bracket /pre right square bracket
[ pre ]
code or output goes here
[ /pre ]
like above with with no spaces
[/pre]
Cynthia_sas
SAS Super FREQ
Hi:
This forum posting shows how to use the [ and ] brackets with "pre" and "/pre" in order to preserve the indenting in code and logs that you post.
http://support.sas.com/forums/thread.jspa?messageID=27609毙

If you were writing HTML (which I know that not everybody does), HTML has <pre> and </pre> tags to "preserve" code formatting on web pages.

But, since the forum application is, itself, an HTML based application, you can't use HTML tags in your posts. So you have to use the same concept but with [ instead of < and with ] instead of > ... if you read the post above, it explains everything.

cynthia

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
  • 7 replies
  • 1058 views
  • 0 likes
  • 5 in conversation