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-2024.png

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.

 

Register now!

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
  • 1115 views
  • 0 likes
  • 3 in conversation