DATA Step, Macro, Functions and more

time

Reply
Contributor
Posts: 30

time

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 . ?

Super User
Posts: 7,793

Re: time

Your pidgin english makes no sense. Please post your question in clear, understandable language.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 30

Re: time

Posted in reply to KurtBremser

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

PROC Star
Posts: 325

Re: time

date gt '20JAN1990'

Contributor
Posts: 30

Re: time

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

Super User
Posts: 19,815

Re: time

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;
Super User
Posts: 7,793

Re: time

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

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

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 30

Re: time

Posted in reply to KurtBremser

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 .

Frequent Contributor
Posts: 149

Re: time

You have attached a csv-file, not a dataset. Please post the code you wrote to import that file.
Contributor
Posts: 30

Re: time

[ Edited ]
Posted in reply to error_prone
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.

Super Contributor
Posts: 345

Re: time

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

Ask a Question
Discussion stats
  • 10 replies
  • 233 views
  • 2 likes
  • 6 in conversation