I cannot figure out this assignment. I cannot get past how to import the files.
ID: 3605113 • Letter: I
Question
I cannot figure out this assignment. I cannot get past how to import the files.
There are 3 Excel files, DATAFILE1.XLS, DATAFILE2.XLS and DATAFILE3.XLS
Copy these files into the folder: C:HW5
Write the SAS codes to convert the 3 Excel files into SAS datasets whose SAS names are:
DATAFILE1.SAS7BDAT
DATAFILE2. SAS7BDAT
DATAFILE3. SAS7BDAT, respectively.
Write the SAS codes to combine all records of DATAFILE1.SAS7BDAT, DATAFILE2.SAS7BDAT and DATAFILE3.SAS7BDAT based on the value of common variable, ID.
Write the SAS codes to combine DATAFILE1.SAS7BDAT and DATAFILE2. SAS7BDAT so that you have records only for those values of ID that are in DATAFILE1.SAS7BDAT.
Write the SAS codes to combine DATAFILE2.SAS7BDAT and DATAFILE3. SAS7BDAT so that you have records only for those values of ID that are in DATAFILE2. SAS7BDAT
Write the SAS codes to combine DATAFILE1.SAS7BDAT and DATAFILE3.SAS7BDAT so that you have records only for those values of ID that are in DATAFILE3.SAS7BDAT.
Write the SAS codes to combine DATAFILE1.SAS7BDAT, DATAFILE2.SAS7BDAT and DATAFILE3.SAS7BDAT so that you have records only for those values of ID that are in ALL 3 SAS data sets.
Any help would be appreciated. I am about to just give up!
Explanation / Answer
There is a Stata user-written (Ado-file) command “usesas” created by Dr. Dan Blanchette. The command uses SAS to run SAS macro savastata.sas and load the SAS dataset into Stata's memory if you have SAS installed in your computer. The user can decide to save the data as a Stata data set using Stata's “save” command after that.
For example:
1. Use Stata's command "ssc install" to download and install it.
ssc install usesas
2. Use "usesas" command to loads a SAS data set from your computer into Stata's memory.
usesas using “c:datayoursasdat.sas7bdat”
3. Save your Stata data if needed.
save datname
Method2:
In SAS, create a transport format file.
libname out XPORT "c:dataclass.xpt";
data out.class;
set sashelp.class;
run;
In STATA, use command "fdause" to read the transport format file into Stata's memory:
cd c:data
fdause class
save class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.