Hi Everyone
Whenever I create a data step and use the Year function as it is used below, it never adds the new variable and I don't get an error. I can add it after the fact in another data step, but not in one.
Is there a syntax issue or just can't be done?
Paul
data s0First (keep=cnty_name County place start stop exit filing_cat1 agecat4);
set workep;
if ep1=1 and year(start) in (2006, 2007, 2008, 2009, 2010, 2011)
and filing_cat1 in ("FNN", "FNA", "FVL");
County=cnty_name;
Year=year(start);
if spellage in (0, 1, 2, 3) then agecat4 = 1;
if spellage in (4, 5, 6) then agecat4 = 2;
if spellage in (7, 8, 9) then agecat4 = 3;
if spellage in (10, 11, 12) then agecat4 = 4;
if spellage in (13, 14, 15) then agecat4 = 5;
if spellage in (16, 17) then agecat4 = 6;
if spellage > 17 or spellage eq . or spellage < 0 then agecat4 = 7;
run;
You use a keep statement to the data set you create and Year is not in the list.
data s0First (keep=cnty_name County place start stop exit filing_cat1 agecat4 YEAR);
You use a keep statement to the data set you create and Year is not in the list.
data s0First (keep=cnty_name County place start stop exit filing_cat1 agecat4 YEAR);
Thank you Anca. It is usually something like this.
Paul
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.