Help using Base SAS procedures

Saving the merged dataset permanently

Reply
N/A
Posts: 0

Saving the merged dataset permanently

Hello ,

i merged two datasets "period2_A" and "period2_sales_data_B" into a single data set "period2" and used the code :

libname sc 'c:\SAS';
data period2_A;
infile 'c:\SAS\period2_sales_data_A.dat';
Input TransactionID $1-8
DateofSale $9-18
LaptopModel $19-24
UnitsSold 25-27
Warranty 28;
Proc sort data = period2_A;
By TransactionID;
proc print data=period2_A;
TITLE 'period2_sales_data_A';
RUN;

data period2_sales_data_B;
infile 'c:\SAS\period2_sales_data_B.dat';
Input TransactionID $1-8
TimeofSale $9-16;
Proc sort data = period2_sales_data_B;
By TransactionID;
proc print data=period2_sales_data_B;
TITLE 'period2_sales_data_B';
RUN;

*Merge data sets period2_A and period2_sales_data_B by Transaction ID;
data period2;
merge period2_A period2_sales_data_B;
By TransactionID;
Proc Print data= period2;
Title "Period 2 sales" ;
Run;


I want to save my merged dataset permamnently in the same location as my two datasets which is libname sc 'c:\SAS'; .

Kind Regards ,

mark
N/A
Posts: 0

Re: Saving the merged dataset permanently

Hi Mark,

Since you have already specified the libname statement in the beginning, You just have to write a small code to save it to the permanent directory as the other two datasets. Try this after you have created period2 in work directory.

data sc.period2;
set period2;
run;

"sc" is the library reference of the directory which you have used to import other two datasets.

I hope this answers your question.

Thanks,
Saurabh.
Ask a Question
Discussion stats
  • 1 reply
  • 233 views
  • 0 likes
  • 1 in conversation