Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Extracting numbers from code

From   daniel klein <>
Subject   Re: st: Extracting numbers from code
Date   Mon, 12 Nov 2012 17:23:22 +0100


"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"))




Create the dummy for item 1 as

g byte dummy1 = (substr(strofreal(item), 1, 1) == "1")

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
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index