I have year variable under which there are many different years
I want to do a report on this dataset and for each year seperately
since year is numeric i cannot use it in the where statement inside the PROC REPORT
when i convert to charecter in the datastep and then use it in the where statement inside the report it says :there were 0 observations where year is 2011
Could you tell me where i went wrong??
YEAR
2011
2011
2010
2012
Thanks
year=put(year(date),4.);
OK I found my mistake...
There were some leading spaces
Could someone help me do all the three things together while extracting year from the date variable????
year=year(date);
year1=put(year,best.);
year2=strip(year1);
Thanks
year=put(year(date),4.);
Hi,
Instead of the 4. if i used best. I am getting leading spaces. Why is that? and could you also show me how to strip in the same line
Is the below one right ??
year=strip(put(year(date),4.));
Thanks
You're making your life way too complicated. Of course you can use a WHERE statement on a numeric variable:
where numvar=2011;
Just don't use quotes when referring to a numeric value.
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.