Reputation: 127
For some reason I'm not being able to read in the data properly. I want to be able to read in a large data set but within only specific dates such as Jan 2004 to FEB 2004. My Code is the following:
DATA Work.sales_fact;
SET Work.sales_fact_subset;
WHERE '01JAN2004'd <= Order_Date <= '14FEB2004'd;
RUN;
PROC PRINT;
RUN;
What am I doing incorrectly?
Upvotes: 0
Views: 76
Reputation: 12465
I think you have DATA
and SET
switched. DATA
is what you want to create. SET
is where the data is coming from.
DATA Work.sales_fact_subset ;
SET Work.sales_fact;
WHERE '01JAN2004'd <= Order_Date <= '14FEB2004'd;
RUN;
PROC PRINT data=Work.sales_fact_subset;
RUN;
Upvotes: 4
Reputation: 705
If your table names and date structure is correct, your query is correct. Here is a sample of what I did with the correct result set.
data inputs;
input Date1 date9. ;
Format date1 date9.;
cards;
01JAN2004
02FEB2004
03MAR2004
04JUN2004
05JUL2004
;
DATA inputss;
SET inputs;
WHERE '01JAN2004'd <= Date1 <= '14FEB2004'd;
RUN;
PROC PRINT;
RUN;
Upvotes: 0
Reputation: 428
Here is an example of this working.. Please check your dataset.
data want;
set sashelp.rent;
where "01feb1999"d <= date <= "02feb2003"d;
run;
Upvotes: 0