BookmarkSubscribeRSS Feed
tjonas
Calcite | Level 5
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?
8 REPLIES 8
DanielKaiser
Pyrite | Level 9
Have you tried the PROC SQL with a WHERE Statement?
tjonas
Calcite | Level 5
I'm a new sas user. Not sure how to use the sql.
DanielKaiser
Pyrite | Level 9
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 🙂
DanielKaiser
Pyrite | Level 9
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.
tjonas
Calcite | Level 5
Has this error:
ERROR: Expression using equals (=) has components that are of different data types
DanielKaiser
Pyrite | Level 9
Hm. write 2010 like this '2010' ?

Sry. Not really good english 😄
tjonas
Calcite | Level 5
Work. thanks.
SPR
Quartz | Level 8 SPR
Quartz | Level 8
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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1408 views
  • 0 likes
  • 3 in conversation