Date: Tue, 27 Jan 2009 13:29:31 -0500
Reply-To: Paul St Louis <pstloui@DOT.STATE.TX.US>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Paul St Louis <pstloui@DOT.STATE.TX.US>
Subject: Re: Proc Transpose
Another good solution. Thanks to all. You guys are awesome.
On Tue, 27 Jan 2009 09:33:34 -0800, Jack Hamilton <jfh@STANFORDALUMNI.ORG>
wrote:
>If you're willing to live with some restrictions on the input and
>output, you can do it with a single PROC REPORT:
>
>=====
>data test;
> input @1 cont_id $9. @14 prsnl_t $10. @28 nbr_prsn 2.;
>datalines;
>000902050 SKILLED 20
>000902050 SKILLED 12
>000902050 SUPERVISOR 10
>000902050 SUPERVISOR 1
>000902050 UNSKILLED 49
>000902050 UNSKILLED 30
>;;;;
>
>proc report data=test nowindows missing
> out=summary (drop=_break_
> rename=(_c2_=skilled _c3_=supervisor
> _c4_=unskilled));
> column cont_id prsnl_t , nbr_prsn nbr_prsn=total;
> define cont_id / group;
> define prsnl_t / across;
> define nbr_prsn / sum;
> define total / sum;
>run;
>=====
>
>Obs cont_id skilled supervisor unskilled total
>
> 1 000902050 32 11 79 122
>
>=====
>
>If you don't know in advance what the values of PRSNL_T will be, this
>approach won't work (or would have to be modified).
|