Help using Base SAS procedures

pull specific year

Reply
Occasional Contributor
Posts: 12

pull specific year

I have a table with the same field names but some of the data is from 2010 and some from 2009. How do I pull just the 2010 data into a new table?
Contributor
Posts: 25

Re: pull specific year

Have you tried the PROC SQL with a WHERE Statement?
Occasional Contributor
Posts: 12

Re: pull specific year

I'm a new sas user. Not sure how to use the sql.
Contributor
Posts: 25

Re: pull specific year

Ok. Have a look at this.

http://www2.sas.com/proceedings/sugi27/p191-27.pdf

If it doesnt help come back and we will go on Smiley Happy
Contributor
Posts: 25

Re: pull specific year

PROC SQL;
CREATE TABLE DESTINATION.TABLE AS
SELECT * /* Take all Variables from your source table otherwise you can list all var. you want to take */
FROM SOURCE.TABLE
WHERE YEARVARIABLE = 2010;
QUIT;


Hope this works. Haven't worked with SQL so much.
Occasional Contributor
Posts: 12

Re: pull specific year

Has this error:
ERROR: Expression using equals (=) has components that are of different data types
Contributor
Posts: 25

Re: pull specific year

Hm. write 2010 like this '2010' ?

Sry. Not really good english Smiley Very Happy
Occasional Contributor
Posts: 12

Re: pull specific year

Work. thanks.
Super Contributor
Super Contributor
Posts: 365

Re: pull specific year

Hello Hjonas,

Try this:
[pre]
data r;
set i;
where YEAR(date)=2010;
run;
[/pre]
If it will not help give us and example of your data.
Sincerely,
SPR
Ask a Question
Discussion stats
  • 8 replies
  • 241 views
  • 0 likes
  • 3 in conversation