Ashish had a problem transferring a string-coded variable to a numeric.
Actually Ashish had several basic problems; I suggest e.g. a Stata
NetCourse (http://www.stata.com/netcourse)
In the meantime: I think the do-file below illustrates commands
useful to Ashish's task.
Good luck,
Svend
---------------------------------------------
clear
input str26 scontent
"Strongly agree"
"Agree"
"Neither agree nor disagree"
"Disagree"
"Strongly disagree"
end
encode scontent , generate(ncontent)
numlabel , add
list
recode ncontent (4=1)(1=2)(3=3)(2=4)(5=5) , generate(content)
list
label define content 1 "Strongly agree" 2 "Agree" ///
3 "Neither agree nor disagree" 4 "Disagree" ///
5 "Strongly disagree"
label values content content
numlabel , add
tab1 content
recode content (1 2=1 "Agree")(3=2 "Neutral") ///
(4 5=3 "Disagree") , generate(content3)
numlabel , add
tab1 content3
---------------------------------------------
__________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone: +45 8942 6090
Home: +45 8693 7796
Email: [email protected]
__________________________________________
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/