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:         Tue, 27 Jan 2009 11:52:15 -0500
Reply-To:     Akshaya Nathilvar <akshaya.nathilvar@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Akshaya Nathilvar <akshaya.nathilvar@GMAIL.COM>
Subject:      Re: Proc Transpose
Comments: To: Paul St Louis <pstloui@dot.state.tx.us>
In-Reply-To:  <200901271554.n0RBqc59018751@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1

One additional solution: 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, count(unique prsnl_t) into :pr1-:pr&sysmaxlong, :count from have; Quit;

%Macro abc;

Data want; do until(last.cont_id); set have; by cont_id; %do _n_=1 %to &count; Total+ifn(PRSNL_T="&&pr&_n_",nbr_prsn,0); &&pr&_n_=sum(&&pr&_n_,ifn(PRSNL_T="&&pr&_n_",nbr_prsn,0)); put _all_ '='; %end; end; drop PRSNL_T NBR_PRSN; Run;

%Mend abc;

%abc

AskhayA!

On Tue, Jan 27, 2009 at 10:54 AM, Paul St Louis <pstloui@dot.state.tx.us>wrote:

> 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