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 (July 2001, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 3 Jul 2001 08:56:39 -0400
Reply-To:     "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject:      Re: DO - END
Content-Type: text/plain; charset="iso-8859-1"

This is a private reply that I am fetching from my archives. The single data step posted yesterday took a bit of reading to figure out what was going on. reading and rereading the data set to put the Total on each obs was ... ingenious. and obfuscating.

See use of proc MEANS/SUMMARY at end.

> From: mto [mailto:mto@admin4.hsc.uth.tmc.edu] > I now understand that I don't need to use TOT=TOT + AMT. > Will you please explain these statements a little more for me: > 1. F =_N_; > 2. L =_N_;

_N_ is the observation number; it is SAS-generated.

> 3. OBSNUM= F TO L;

well, I would have named these Lo and Hi. hmmmm, F and L, ... ah: First and Last!

> 4. POINT=OBSNUM;

> > 11 DO OBSNUM= F TO L; > > 12 SET MERGED POINT=OBSNUM; OUTPUT; END; this means: read the data set from ObsNum = First to Last for this ID number.

> 5. "You could compute the Tot with proc MEANS and merge the > MEANS output with MERGED".

others will chime in that you can use proc SUMMARY instead.

proc MEANS data = MERGED; *noprint; class Trid;%*may not be needed; by Trid; output out = SUM %*data set name; sum = Sum; %*variable name: Tot?;

DATA MERGED; merge MERGED SUM; by Trid;

much simpler.

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov OpSys: WinNT Ver: 8.1 ---> cheerful provider of UNTESTED SAS code!*! <---


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