LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 8 Apr 2009 16:33:52 -0400
Reply-To:     msz03@albany.edu
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mike Zdeb <msz03@ALBANY.EDU>
Subject:      Re: Percentages
Content-Type: text/plain;charset=iso-8859-1

hi ... OK, just in case you want the percentages in a data set, not in a table ...

data x; input ID Cat Var; datalines; 1 1 25 1 2 35 1 3 30 1 4 10 2 1 18 2 2 22 2 3 60 2 4 0 3 1 32 3 2 70 3 4 100 ; run;

proc freq data=x; table id*cat / sparse noprint outpct out=pcts (drop=percent pct_col); weight var; run;

proc print data=pcts noobs; by id; format pct_row 6.1; run;

-- Mike Zdeb U@Albany School of Public Health One University Place Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

> Here is my data set > > ID Cat Var > 1 1 25 > 1 2 35 > 1 3 30 > 1 4 10 > 2 1 18 > 2 2 22 > 2 3 60 > 2 4 0 > > I want the percentages for each category for each ID. So the data set > should be > > ID Cat Var Per > 1 1 25 0.25 > 1 2 35 0.35 > 1 3 30 0.3 > 1 4 10 0.1 > 2 1 18 0.18 > 2 2 22 0.22 > 2 3 60 0.60 > 2 4 0 0 > > Can someone please help. > Thank You > Randy > >


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