Hi everyone, +========================================================================+ This email is confidential and may be privileged. If you have received it in error, please notify us immediately and then delete it. Please do not copy it, disclose its contents or use it for any purpose. +========================================================================+ |
Administrator
|
You've not said what you want the values of the new variables to be. Presumably you want N indicator (or dummy) variables, is that right?
Do you have to have letters (A, B, C, ...N) as suffixes for the new variable names? I ask, because it would be easier if you could settle for numeric suffixes (Product_1, Product_2, ... Product_N).
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Administrator
|
In reply to this post by Ketty Noonan-2
Use VALUELABEL function to create a new string variable, fix any spaces with REPLACE, then use that as INDEX in CASESTOVARS.
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 Bruce Weaver
Off-list message from Ketty, whose response to the list generated an error message. Just found this in my hotmail inbox, which I do not check too frequently (as per the note in my sig file below).
I don't have time to look at it right now, but maybe someone else will jump in meanwhile. --- Start of response from Ketty --- Yes, I want N indicator (or dummy) variables. One variable for each product/brand/category, etc. An example of the dataset id Group1_buyer Group2_buyer Group3_buyer Product Quantity 1 New Lost PL 1 1 New Lost Brand A 0 1 New Lost Brand B 0 In this case, I'd like to rename Group1_buyer to reflect PL, Group2_buyer to reflect Brand A and Group3_buyer to reflect Brand B. The challenge is my syntax needs to be general. Product is not always PL, Brand A and Brand B. In a different database, it can be "Perfume", "Splash", etc. I really appreciate any help. Thanks! --- End of response from Ketty ---
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Administrator
|
Wouldn't it be grand to see what the resulting data should look like?
And I have having a terrible time parsing the following into any meaningful code. OTOH: Here is a way to turn value labels into varnames using the outline from my previous response. DATA LIST FREE / Product other. BEGIN DATA 1 3 2 6 3 4 END DATA. VALUE LABELS Product 0 'Product 0' 1 'Product A' 2 'Product B' 3 'Product C' . COMPUTE ID=$CASENUM. STRING lab (A20). COMPUTE lab=REPLACE(VALUELABEL(Product)," ","_"). MATCH FILES / FILE * / KEEP ID product lab. CASESTOVARS ID=ID /AUTOFIX=NO / INDEX=lab . LIST. ID Product_A Product_B Product_C 1.00 1.00 . . 2.00 . 2.00 . 3.00 . . 3.00 Number of cases read: 3 Number of cases listed: 3
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?" |
Let me be more clear. Here is my dataset. +========================================================================+ This email is confidential and may be privileged. If you have received it in error, please notify us immediately and then delete it. Please do not copy it, disclose its contents or use it for any purpose. +========================================================================+ |
Administrator
|
This post was updated on .
Wouldn't it be grand to see what the resulting data should look like?
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?" |
The resulting data looks the same. The only changes are the variable name group1 is now Brand_A, group2 is now Brand_B and group3 is now Private_Label. +========================================================================+ This email is confidential and may be privileged. If you have received it in error, please notify us immediately and then delete it. Please do not copy it, disclose its contents or use it for any purpose. +========================================================================+ |
Administrator
|
AFAICT, the question as presented makes absolutely no sense .
1. You probably DON'T have only 3 'groups'. 2. There are multiple responses for some cases?. ---
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?" |
In reply to this post by David Marso
1. Yes, I might have more than 3 groups. The number of group varies depending on the dataset. DATA LIST LIST / id product quantity * Brand_A(A15) Brand_B(A15) Private_Label(A15). BEGIN DATA. 1, 1, 1, "Retained","Lost","Lost" +========================================================================+ This email is confidential and may be privileged. If you have received it in error, please notify us immediately and then delete it. Please do not copy it, disclose its contents or use it for any purpose. +========================================================================+ |
Administrator
|
I would scratch the rename variables idea and simply do a VARSTOCASES.
Rewrite your CTABLES syntax to work with the modified data structure. I'm done. ---
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 |