LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 8 Sep 2005 12:35:12 -0400
Reply-To:     wanda@wandaupole.com
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "wanda@wandaupole.com" <wanda@WANDAUPOLE.COM>
Subject:      ERROR destroys BY/ID
Content-type: text/plain; charset=iso-8859-1

Here's another of my weird SAS problems.

Normally, when you do PROC PRINT with a BY statement and an ID statement, with the same variables in the BY and ID statements, SAS makes a listing that has a separate group for every combination of the BY/ID variables, with each group separated by a line. Here's an example. This code:

proc sort data = sashelp.class out = class; by sex; run;

proc print noobs data = class; by sex; id sex; run;

produces this output:

Sex Name Age Height Weight

F Alice 13 56.5 84.0 Barbara 13 65.3 98.0 Carol 14 62.8 102.5 Jane 12 59.8 84.5 Janet 15 62.5 112.5 Joyce 11 51.3 50.5 Judy 14 64.3 90.0 Louise 12 56.3 77.0 Mary 15 66.5 112.0

M Alfred 14 69.0 112.5 Henry 14 63.5 102.5 James 12 57.3 83.0 Jeffrey 13 62.5 84.0 John 12 59.0 99.5 Philip 16 72.0 150.0 Robert 12 64.8 128.0 Ronald 15 67.0 133.0 Thomas 11 57.5 85.0 William 15 66.5 112.0

But if I'm in an interactive session, and I get some error message (it seems to happen particularly with SORT errors), PROC PRINT suddenly starts putting each group on a separate page, instead of just separating them by lines. Suppose I want to do the same thing as above by age instead of sex, but I forget to submit the PROC SORT for age before the PROC PRINT. Then I get this error message in the LOG:

ERROR: Data set WORK.CLASS is not sorted in ascending sequence. The current by-group has Age = 14 and the next by-group has Age = 12.

I submit the sort statement, resubmit PROC PRINT, and suddenly every age group is on a separate page.

And there seems to be no way to fix it for the session. The only thing I can do is to close SAS and start all over again. Does anyone know a way around this?

-------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ .


Back to: Top of message | Previous page | Main SAS-L page