SPSS macro help needed

5 messages
Open this post in threaded view
|

SPSS macro help needed

 Hi I need put this in a loop (possibly in a MACRO) to calculate the percentiles so i can run it FROM year 1984 to year 2012 (29 times) BY 2 sexes (M and F) by 3 age groups (15-34 y, 35-64 y, 65+ y)=29x2x3=174 times. How can i achieve this.. please guide me with a macro command. FREQUENCIES VARIABLES=DRINKSPERDAY /NTILES=5 /PERCENTILES=20.0 40.0 60.0 80.0 100.0 /STATISTICS=MINIMUM MAXIMUM MEAN /ORDER=ANALYSIS. Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Open this post in threaded view
|

Re: SPSS macro help needed

 Please look at SPLIT FILE command. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Open this post in threaded view
|

Re: SPSS macro help needed

 In reply to this post by jaycamh Hi,try this:* Assuming that sex and age are numerical variables with ranges 1-2 and 1-3.* Otherwise please (auto)recode.DEFINE !macrohelp(year = !TOKENS(2) / sex = !TOKENS(2) / age = !TOKENS(2))!LET !number = !NULL!DO !y = !HEAD(!year) !TO !Tail(!year) !DO !s = !HEAD(!sex) !TO !Tail(!sex) !DO !a = !HEAD(!age) !TO !Tail(!age)                    !LET !number = !CONCAT(!number,1)          ECHO !QUOTE(!CONCAT( "Table ", !LENGTH(!number), ": Year = ",!y," | Sex = ", !s, " | Age = ", !a)).                    TEMPORARY.                    SELECT IF (year = !y & sex = !s & age = !a).                    FREQUENCIES VARIABLES=DRINKSPERDAY                     /NTILES=5                     /PERCENTILES=20.0 40.0 60.0 80.0 100.0                     /STATISTICS=MINIMUM MAXIMUM MEAN                     /ORDER=ANALYSIS. !DOEND !DOEND!DOEND!ENDDEFINE.!macrohelp year = 1984 2012 sex = 1 2 age = 1 3. Mario GieselMunich, Germany Am Dienstag, 6. August 2019, 08:35:11 MESZ hat jaycamh <[hidden email]> Folgendes geschrieben: Hi I need put this in a loop (possibly in a MACRO) to calculate the percentiles so i can run it FROM year 1984 to year 2012 (29 times) BY 2 sexes (M and F) by 3 age groups (15-34 y, 35-64 y, 65+ y)=29x2x3=174 times. How can i achieve this.. please guide me with a macro command. FREQUENCIES VARIABLES=DRINKSPERDAY /NTILES=5 /PERCENTILES=20.0 40.0 60.0 80.0 100.0 /STATISTICS=MINIMUM MAXIMUM MEAN /ORDER=ANALYSIS. Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD