Hi
I'm a bit lost with a simple task. I have 2 variables, X and Y. Both are string. I need to create Z as this If Y is missing, just do Z=X. Else Z=Y. I tried something like Do if missing(y) compute z=y else z=y end if execute but it didn't work. Can you helpm me? Thanks |
Administrator
|
First off, you don't indicate whether you initialized z (look up STRING command in the FM)!
You are also missing command terminators! In the future you should do yourself and us a favor by posting the exact error messages/specifics of what 'it didn't work' means. --
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
|
Also,
else z=y is malformed. See examples of DO IF in the FM.
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?" |
Please, don't answer this topic.
Really your attitude is so rude. |
In reply to this post by jfca283
Without examining your code, the first
issue that springs to mind is: Have you defined user-missing values for
your strings? There is no system-missing value for strings. A blank string
is considered a valid value unless you define it as missing.
If you assumed blanks strings are treated as missing, you could either define a blank string as user missing or try DO IF Y=''. Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: jfca283 <[hidden email]> To: [hidden email] Date: 11/24/2014 10:49 AM Subject: Copy string variable by condition Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi I'm a bit lost with a simple task. I have 2 variables, X and Y. Both are string. I need to create Z as this If Y is missing, just do Z=X. Else Z=Y. I tried something like *Do if missing(y) compute z=y else z=y end if execute *but it didn't work. Can you helpm me? Thanks -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Copy-string-variable-by-condition-tp5728008.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 ===================== 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 |
Administrator
|
In reply to this post by jfca283
In the spirit of teaching someone how to fish rather than handing them a fish, I suggest you try Google searches on the following terms:
1. spss create new string variable 2. spss do if You should find some relevant examples in the search results.
--
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 jfca283
What a sad, silly person you are!
If you interpreted my comment as rude then you need to sprout a skin! I will offer no more interdiction to any of your future rookie flailing episodes! --
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 |