Friday, 6 November 2009

Creating a string variable to calculate BTH participation till 2006

*Create a string variable by the name years. The variable a width of 7 characters but i ended up using just one. Then Use IF command to assign "1" to the variable in all cases where the year was less than 2006.*****

string years (A7).

if year1="2001-02" | year1="2002-03" | year1="2003-04" | year1="2004-05" | year1="2005-06" years="1".
if year2="2001-02" | year1="2002-03" | year1="2003-04" | year1="2004-05" | year1="2005-06" years="1".
if year3="2001-02" | year1="2002-03" | year1="2003-04" | year1="2004-05" | year1="2005-06" years="1".
if year4="2001-02" | year1="2002-03" | year1="2003-04" | year1="2004-05" | year1="2005-06" years="1".
if year5="2001-02" | year1="2002-03" | year1="2003-04" | year1="2004-05" | year1="2005-06" years="1".

fre years.

list Year1 Year2 Year3 Year4 Year5 TotalYears years.

**Frequency of only those cases who meet the above criteria, ie less than 2006********.

temp.
select if years="1".
fre TotalYears/sta=all.

No comments: