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 (January 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 28 Jan 2009 04:59:20 -0800
Reply-To:     ajayohri@yahoo.com
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         ajay ohri <ajayohri@YAHOO.COM>
Subject:      Re: Proc Transpose
Comments: To: karma <dorjetarap@GOOGLEMAIL.COM>
In-Reply-To:  <d6a0d8f10901280323v581401b5k9f570e0cbce74549@mail.gmail.com>
Content-Type: text/plain; charset=iso-8859-1

ods html file=' ';

proc means data=olddata sum; class CONT_ID; out=newdata; quit;

proc print data=newdata; quit;

--- On Wed, 1/28/09, karma <dorjetarap@GOOGLEMAIL.COM> wrote:

> From: karma <dorjetarap@GOOGLEMAIL.COM> > Subject: Re: Proc Transpose > To: SAS-L@LISTSERV.UGA.EDU > Date: Wednesday, January 28, 2009, 4:53 PM > Yet Another Way > > Using a DOW and a few retains > > data have; > input CONT_ID PRSNL_T :$10. NBR_PRSN ; > cards; > 000902050 SKILLED 20 > 000902050 SKILLED 12 > 000902050 SUPERVISOR 10 > 000902050 SUPERVISOR 1 > 000902050 UNSKILLED 49 > 000902050 UNSKILLED 30 > ; > > proc sql noprint; > select unique prsnl_t > into :names separated by ' ' > from have order by prsnl_t; > quit; > %put &names; > > data want(keep=cont_id &names total); > retain cont_id &names total; > array names[*] &names; > do until (last.prsnl_t); > set have; > by cont_id prsnl_t; > x=sum(0,x,nbr_prsn); > end; > names[_n_] = x; > total = sum(0, total, x); > if last.cont_id; > run; > proc print;run; > > 2009/1/27 Paul St Louis <pstloui@dot.state.tx.us>: > > Have: > > CONT_ID PRSNL_T NBR_PRSN > > 000902050 SKILLED 20 > > 000902050 SKILLED 12 > > 000902050 SUPERVISOR 10 > > 000902050 SUPERVISOR 1 > > 000902050 UNSKILLED 49 > > 000902050 UNSKILLED 30 > > > > Need: > > CONT_ID SKILLED UNSKILLED SUPERVISOR TOTAL > > 000902050 32 79 11 122 > > > > I'm stumped on Proc Transpose, and can't > figure out how to get the results. > > I can split up my dataset into skilled, supervisor, > unskilled, them proc > > summ, but there must be a better way. > >


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