- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 02-18-2010 10:40 AM
(1524 views)
Hello ,
When i run the code below i get message that the WORK.PERIOD2A.DATA does not exist . could you suggest please what mistake i'm doing.
libname example 'c:\SAS' ;
data sc.period2A;
infile 'c:\Cwa\period2_sales_data_A.dat';
Input TransactionID $1-8
DateofSale $9-18
LaptopModel $19-24
UnitsSold 25-27
Warranty 28;
Proc Sort Data = period2A;
By TransactionID;
proc print data=period2A;
run;
I want to save the sorted dataset in the C file.
kind regards ,
siddharth
When i run the code below i get message that the WORK.PERIOD2A.DATA does not exist . could you suggest please what mistake i'm doing.
libname example 'c:\SAS' ;
data sc.period2A;
infile 'c:\Cwa\period2_sales_data_A.dat';
Input TransactionID $1-8
DateofSale $9-18
LaptopModel $19-24
UnitsSold 25-27
Warranty 28;
Proc Sort Data = period2A;
By TransactionID;
proc print data=period2A;
run;
I want to save the sorted dataset in the C file.
kind regards ,
siddharth
5 REPLIES 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You create sc.period2A but I do not see where you create period2A.
So it does not exist.
Do you have a library sc defined, it is not in this code.
Also put in some run; statements and you will have better luck reading your log.
So it does not exist.
Do you have a library sc defined, it is not in this code.
Also put in some run; statements and you will have better luck reading your log.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello ,
thank you for the suggestion. I changed the code as :
libname sc 'c:\Cwa';
data period1;
infile 'c:\Cwa\period1_sales_data.dat';
Input TransactionID $1-8
DateofSale $9-18
TimeofSale $19-26
LaptopModel $27-32
UnitsSold 33-35
Warranty 36;
proc sort data = period1;
By DateofSale;
proc print data = period1;
title 'period 1 Sales ';
RUN;
I get the sorted output in the output window when i use above code then i add sc in the data line and then rerun the code to save the permannent file of sorted ( by date of sale ) file. but when i open the file i dont get the data in sorted format .
Kindly guide.
regrards ,
markc
thank you for the suggestion. I changed the code as :
libname sc 'c:\Cwa';
data period1;
infile 'c:\Cwa\period1_sales_data.dat';
Input TransactionID $1-8
DateofSale $9-18
TimeofSale $19-26
LaptopModel $27-32
UnitsSold 33-35
Warranty 36;
proc sort data = period1;
By DateofSale;
proc print data = period1;
title 'period 1 Sales ';
RUN;
I get the sorted output in the output window when i use above code then i add sc in the data line and then rerun the code to save the permannent file of sorted ( by date of sale ) file. but when i open the file i dont get the data in sorted format .
Kindly guide.
regrards ,
markc
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need to output the sorted data to the permanent lib.
proc sort data = period1 out = sc.period1;
By DateofSale;
RUN;
proc sort data = period1 out = sc.period1;
By DateofSale;
RUN;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello ,
I used the code
libname sc'c:\Cwa';
data period2A;
infile 'c:\Cwa\period2_sales_data_A.dat';
Input TransactionID $1-8
DateofSale $9-18
LaptopModel $19-24
UnitsSold 25-27
Warranty 28;
proc sort data = period2Aout = sc.period2A;
By DateofSale;
RUN;
proc print data = period2A;
title 'period 2A Sales ';
RUN;
but it didnt work .Do i need to change the format of date in the input
.The date is in format :17/11/2009
Any chage would you recommend in the date format to use proc sort .I used date as a character $ variable .
kind reagards ,
mark
I used the code
libname sc'c:\Cwa';
data period2A;
infile 'c:\Cwa\period2_sales_data_A.dat';
Input TransactionID $1-8
DateofSale $9-18
LaptopModel $19-24
UnitsSold 25-27
Warranty 28;
proc sort data = period2Aout = sc.period2A;
By DateofSale;
RUN;
proc print data = period2A;
title 'period 2A Sales ';
RUN;
but it didnt work .Do i need to change the format of date in the input
.The date is in format :17/11/2009
Any chage would you recommend in the date format to use proc sort .I used date as a character $ variable .
kind reagards ,
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Rather than just saying "it didn't work" you should include the relevant portion of the SAS log.
if that is the exact code used then you need a space between period2A and out= in:
proc sort data = period2Aout = sc.period2A;
This would likely cause SAS to not even run the proc sort.
if that is the exact code used then you need a space between period2A and out= in:
proc sort data = period2Aout = sc.period2A;
This would likely cause SAS to not even run the proc sort.