Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: If statements and value labels


From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: If statements and value labels
Date   Sun, 3 Sep 2006 15:50:17 +0200

Carter Rees wrote:
 
Is it possible to use and if statement in conjunction with -label- values?
I have a variable testcode with values of 1-90 indicating 90 different
teacher certification tests.  Versioncode has values of 1 & 2 which indicate
a specific version of the test used.  Subpart has values of 1-7 naming the
different parts of the test for that version in that test.    The subpart
titles (and total number) within each version of a test are not always the
same across versions.  
 
I would like to assign different subpart value labels depending on the
versioncode of a test.  Below is an example for test 1.  
 
studentid testcode versioncode subpart
    22     1   1    1
    22     1   1    2
    22     1   1    3
    22     1   1    4
    22     1   1    5
    13     1   2    1
    13     1   2    2
    13     1   2    3
    13     1   2    4
------------------------------------------------------------
 
The relationship between a code and its value label is simple and straightforward, and what you suggest is not possible, if I understand you right.
 
I understand you this way: The coding of -subpart- is not the same for all values of -versioncode-. Suggestion: create a new variable combining the information in -versioncode- and -subpart-:
  gen subpart2 = 10*versioncode + subpart
 
Next, assign value labels to -subpart2-
 
Do -subpart- codes also mean different things for different values of -testcode-?The same principle could be applied.
 
Hope this helps.
Svend
________________________________________________________ 
 
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:  +45 8942 6090 
Phone, home:  +45 8693 7796 
Fax:          +45 8613 1580 
E-mail:       sj@soci.au.dk 
_________________________________________________________ 

*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index