Hello All ,
I have to find a count of each variables within absolute 5, 10, 15 & 20%. I came up with idea using 'Compute' and writing a formula that gives me 1 for true value and 0 for false. Then I can run 'case summaries' and count the sum for each VAR. I'm still looking for easier way to calculate this. My problem is, I need to present a ratio (counts within 5, 10, 15 & 20% to the sum of counts for each VAR). I figured I can run a report 'in columns' but that gives me only one ratio - between two variables. How can I get a ratio for VAR1 within 5, 10, 15 & 20%, VAR2 within 5, 10, 15 & 20% etc.. at once, on the same report? Syntax: SORT CASES BY State (A) . Report /FORMAT= CHWRAP(ON) BRKSPACE(-1) SUMSPACE(0) AUTOMATIC PREVIEW(OFF) CHALIGN(BOTTOM) CHDSPACE(1) UNDERSCORE(ON) ONEBREAKCOL(OFF) PAGE(1) MISSING'.' LENGTH(1, 59)ALIGN(LEFT) TSPACE(1) FTSPACE(1) MARGINS(1,74) /TITLE= RIGHT 'Page )PAGE' /VARIABLES VP4_5 'VP4_5' 'Sum' (RIGHT) (OFFSET(0)) (10) VP4_10 'VP4_10' 'Sum' (RIGHT) (OFFSET(0)) (10) VP4_15 'VP4_15' 'Sum' (RIGHT) (OFFSET(0)) (10) VP4_20 'VP4_20' 'Sum' (RIGHT) (OFFSET(0)) (10) Var 'Var%' 'N' (RIGHT) (OFFSET(0))(8) $dummy01 (DUMMY) 'Total' (RIGHT) (OFFSET(0))(6) /BREAK (TOTAL) /SUMMARY SUM(VP4_5) SUM(VP4_10) SUM(VP4_15) SUM(VP4_20) VALIDN(Var) PCT( SUM(VP4_20) VALIDN(Var) ) ($dummy01 (PCT)(0)) 'Grand Total' (1) /BREAK State (LABELS) (LEFT) (OFFSET(0)) (SKIP(1))(8) /SUMMARY SUM(VP4_5) SKIP(0) SUM(VP4_10) SUM(VP4_15) SUM(VP4_20) VAL IDN(Var) PCT( SUM(VP4_20) VALIDN(Var) ) ($dummy01(PCT)(0)). My sample size is usually couple thousands. Example: VAR1 VAR2 VAR3 -3% 1% 0% 2% -3% -1% 11% 10% 13% 25% 20% 22% 65% 70% 60% -8% -12% -6% 17% 15% 14% Thank you for any help! Agata Lekan |
Hi Agata,
Maybe something like this? I hope the word "ratio" is not a keyword, I mean that it can just be used as a variable name. compute dummy = 1. count output = input (yourvaluerangehere, e.g. 1,2 or something). aggregate / outfile = * / break = dummy / count = n / sigma 'summed output' = sum (output). compute pct = (sigma / count) * 100. recode pct (lo thru 5 = 1) (5.00001 thru 10 = 2) (10.00001 thru 15 = 3) (15.00001 thru 20 = 4) (20 thru hi = 5) (sysmis=copy) (else=-1) into ratio. missing values ratio (-1). variable label ratio "Categorized proportion". fre ratio. Cheers!! Albert-Jan --- "Lekan, Agata" <[hidden email]> wrote: > Hello All , > > I have to find a count of each variables within > absolute 5, 10, 15 & 20%. I > came up with idea using 'Compute' and writing a > formula that gives me 1 for > true value and 0 for false. Then I can run 'case > summaries' and count the > sum for each VAR. I'm still looking for easier way > to calculate this. > My problem is, I need to present a ratio (counts > within 5, 10, 15 & 20% to > the sum of counts for each VAR). > I figured I can run a report 'in columns' but that > gives me only one ratio - > between two variables. How can I get a ratio for > VAR1 within 5, 10, 15 & > 20%, VAR2 within 5, 10, 15 & 20% etc.. at once, on > the same report? > > Syntax: > SORT CASES BY State (A) . > > Report > > /FORMAT= CHWRAP(ON) BRKSPACE(-1) SUMSPACE(0) > AUTOMATIC > > PREVIEW(OFF) CHALIGN(BOTTOM) CHDSPACE(1) > > UNDERSCORE(ON) ONEBREAKCOL(OFF) > > PAGE(1) MISSING'.' LENGTH(1, 59)ALIGN(LEFT) > TSPACE(1) FTSPACE(1) > > MARGINS(1,74) > > /TITLE= > > RIGHT 'Page )PAGE' > > /VARIABLES > > VP4_5 'VP4_5' 'Sum' (RIGHT) (OFFSET(0)) (10) > > VP4_10 'VP4_10' 'Sum' (RIGHT) (OFFSET(0)) (10) > > VP4_15 'VP4_15' 'Sum' (RIGHT) (OFFSET(0)) (10) > > VP4_20 'VP4_20' 'Sum' (RIGHT) (OFFSET(0)) (10) > > Var 'Var%' 'N' (RIGHT) (OFFSET(0))(8) > > $dummy01 (DUMMY) 'Total' (RIGHT) (OFFSET(0))(6) > > /BREAK (TOTAL) > > /SUMMARY SUM(VP4_5) SUM(VP4_10) SUM(VP4_15) > SUM(VP4_20) VALIDN(Var) > > PCT( SUM(VP4_20) VALIDN(Var) ) ($dummy01 > > (PCT)(0)) 'Grand Total' (1) > > /BREAK State (LABELS) (LEFT) (OFFSET(0)) > (SKIP(1))(8) > > /SUMMARY SUM(VP4_5) SKIP(0) SUM(VP4_10) SUM(VP4_15) > SUM(VP4_20) VAL > > IDN(Var) PCT( SUM(VP4_20) VALIDN(Var) ) > > ($dummy01(PCT)(0)). > > > > My sample size is usually couple thousands. > > Example: > > > > > VAR1 > > VAR2 > > VAR3 > > > -3% > > 1% > > 0% > > > 2% > > -3% > > -1% > > > 11% > > 10% > > 13% > > > 25% > > 20% > > 22% > > > 65% > > 70% > > 60% > > > -8% > > -12% > > -6% > > > 17% > > 15% > > 14% > > > > Thank you for any help! > Agata Lekan > Cheers! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ____________________________________________________________________________________ Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com |
Free forum by Nabble | Edit this page |