Hi All,
I have variables from cat.1 to cat.2509, all of which are string variables. And I have 9.5 laks cases. I want to create a variable which has the non missing counts of the variables from cat.1 to cat.2509.
a sample of data structure follows below ID Cat.1 Cat.2 ---------------------Cat.2509 totalcount 1 hiv dementia ..........................coad 2509
2 fever fever 2
3 0 4 coad IBD 2 5 IBD 1
Regards, Rajesh M S |
How do you know which strings are “missing”? Are they all blank? Are any of them entered as sysmis? How many different strings are there? Have a look at AUTORECODE, but be careful not to overwrite your data if you save anything: use a new name. You might be able to use RECODE or COUNT, but without knowing what your data actually look like I can’t help. If you can send me off-list, and in complete confidence, (an extract from) your *.sav file, I’ll have a look at it and see what I can suggest. John F Hall (Mr) [Retired academic survey researcher] Email: [hidden email] Website: www.surveyresearch.weebly.com SPSS start page: www.surveyresearch.weebly.com/spss-without-tears.html From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Rajeshms Hi All, I have variables from cat.1 to cat.2509, all of which are string variables. And I have 9.5 laks cases. I want to create a variable which has the non missing counts of the variables from cat.1 to cat.2509. a sample of data structure follows below ID Cat.1 Cat.2 ---------------------Cat.2509 totalcount 1 hiv dementia ..........................coad 2509 2 fever fever 2 3 0 4 coad IBD 2 5 IBD 1 -- Regards, Rajesh M S |
In reply to this post by Rajeshms
count n_miss = cat.1 to cat.2509 ("").
This might not do what you want when there are multiple spaces, though. In some cases you need RTRIM: compute n_miss = 0. do repeat #cat = cat.1 to cat.2509. +if( char.length(rtrim(#cat)) eq 0 ) n_miss = n_miss + 1. end repeat. Btw, I don't know what you mean with "And I have 9.5 laks cases.". Regards, Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -------------------------------------------- On Tue, 11/19/13, Rajeshms <[hidden email]> wrote: Subject: [SPSSX-L] Count cases in string data To: [hidden email] Date: Tuesday, November 19, 2013, 12:14 PM Hi All, I have variables from cat.1 to cat.2509, all of which are string variables. And I have 9.5 laks cases. I want to create a variable which has the non missing counts of the variables from cat.1 to cat.2509. a sample of data structure follows below ID Cat.1 Cat.2 ---------------------Cat.2509 totalcount 1 hiv dementia ..........................coad 2509 2 fever fever 2 3 0 4 coad IBD 25 IBD 1 -- Regards, Rajesh M S ===================== 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 Rajeshms
I'm having trouble making any sense of your data structure.
Please don't assume we all have InterneTelepathy and/or ESPss What is 9.5 laks? Not familiar with that word.
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?" |
--------------------------------------------
On Tue, 11/19/13, David Marso <[hidden email]> wrote: Subject: Re: [SPSSX-L] Count cases in string data To: [hidden email] Date: Tuesday, November 19, 2013, 1:34 PM I'm having trouble making any sense of your data structure. Please don't assume we all have InterneTelepathy and/or ESPss What is 9.5 laks? Not familiar with that word. ===> Perhaps he means lakhs, so 950,000 see under "Numeral sytstem" http://en.wikipedia.org/wiki/Indian_rupee ===================== 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 |
Free forum by Nabble | Edit this page |