BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
5 REPLIES 5
Flip
Fluorite | Level 6
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.
deleted_user
Not applicable
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
Flip
Fluorite | Level 6
You need to output the sorted data to the permanent lib.


proc sort data = period1 out = sc.period1;
By DateofSale;
RUN;
deleted_user
Not applicable
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
RickM
Fluorite | Level 6
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.

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
  • 5 replies
  • 607 views
  • 0 likes
  • 3 in conversation