This post was updated on .
CONTENTS DELETED
The author has deleted this message.
mils
|
Hi everyone,
I have the following data: id timeperiode brand 1 q1 a 1 q1 a 2 q1 a 2 q1 b 2 q1 b 3 q1 c . . . 43 q2 b . . . and I woul like to restructure the data to look like: timeperiode brand counts percentage q1 a 3 50 q1 b 2 33 q1 c 1 17 any help will be much appreciate. Please, let me know if you need more information. Thanks in advance. ----- mils -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Restructure-file-tp5724361.html 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
mils
|
In reply to this post by mils
************************************************************.
*Orig data. data list free / timeperiode brand (2A2) counts weighting. begin data. q1 a 1 0.6 q1 a 1 0.6 q1 a 1 0.6 q1 b 2 0.4 q1 b 2 0.4 q1 c 3 0.2 end data. *1st Aggregate - note I use timeperiode as a break variable as well (a guess). dataset declare agg. aggregate outfile = 'agg' /break = timeperiode brand /counts=N /*could use FIRST(counts) here as well given your example */ /weighting=SUM(weighting). dataset activate agg. *2 find totals to calc prop. aggregate outfile = * mode=addvariables /break = timeperiode /countsTot=SUM(counts) /weightingTot=SUM(weighting). compute proportions = (counts/countsTot)*100. compute weighting_proportions = (weighting/weightingTot)*100. *match files file = * /drop counts weighting countsTot weightingTot. freq var proportions weighting_proportions /format = notable /statistics = sum. ************************************************************. |
Administrator
|
In reply to this post by mils
Please look up the AGGREGATE command!
--
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Administrator
|
In reply to this post by mils
Mils,
In the future please don't double post under two separate topics! D.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |