Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Extracting numbers from code
From
daniel klein <[email protected]>
To
[email protected]
Subject
Re: st: Extracting numbers from code
Date
Mon, 12 Nov 2012 17:23:22 +0100
Oops.
"assumtion" shoud read assumption, but this is not why I am writing
again. The code for dummies 2-11 should work fine, however my code to
create the first dummy is not a good idea. Instead try
g byte dummy1 = (substr(strofreal(item), 1, 1) == "1") &
!(inlist(substr(strofreal(item), 2, 1), "0", "1"))
Best
Daniel
--
Sanja,
[...]
Create the dummy for item 1 as
g byte dummy1 = (substr(strofreal(item), 1, 1) == "1")
Best
Daniel
--
Good day.
I have received a dataset from a survey in which numerous questions
asked respondents to check all that apply.
As an example, one such question had 11 possible items that
respondents could check.
The data is coded in such a way that if a respondent checked item 2,
item 4, item 7, item 10 and item 11, then the response in the dataset
is coded 2471011.
I need to create dummy variables for each item.
[...]
Any advice would be greatly appreciated.
Kind regards
Sanja
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/