BookmarkSubscribeRSS Feed
mehak
Calcite | Level 5

Can anyone please tell me how can i subset the data after a  given date  . I think i have to use date fn . But dnt know how to keep date in a conditional statement how to find variable informat . ?

10 REPLIES 10
mehak
Calcite | Level 5

how can i seperate out the data launged after 20 jan 1990 from vechiles

kiranv_
Rhodochrosite | Level 12

date gt '20JAN1990'

mehak
Calcite | Level 5

sir i want to get all the date after 20 jan . Then what i should do ?

Reeza
Super User

You should read this chapter. 

http://documentation.sas.com/?docsetId=lrcon&docsetTarget=p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm&docsetVer...

 

You can filter dates with a standard IF/WHERE statement, but you need to use dates with the proper format. 

 

'01JAN2017'd -> note the quotes, 3 letter month, and d after the quotes

 

data want;
set sashelp.stocks;

where date > '01Jan2000'd;

run;
Kurt_Bremser
Super User

Please post some example data, and which rows you want selected/not selected.

Basically, you can use a where condition or a subsetting if.

mehak
Calcite | Level 5

i have attached the sample  data set . Can you please know tell me how can i seperate out data for passangers vehicles launced after 20 jan .

error_prone
Barite | Level 11
You have attached a csv-file, not a dataset. Please post the code you wrote to import that file.
mehak
Calcite | Level 5
libname _class_s "/folders/myfolders/ 1";

PROC IMPORT DATAFILE="/folders/myfolders/1/Car_sales.csv"
OUT=_class_s.Car_sales
DBMS=csv
REPLACE;
RUN;

 I have used the above code to import the file and it has import succesfully as i am able to see all the data present in my car file.

andreas_lds
Jade | Level 19

proc imports recognizes Latest_Launch as SAS-date, so use the example code posted by @Reeza.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

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
  • 10 replies
  • 1305 views
  • 2 likes
  • 6 in conversation