While working on your inventory project, you realize that you need to read the data sets into SAS before you begin analysis. Your SAS program needs to read all the datasets that are necessary to predict store sales.
Reading in Dates: You can use import or infile to import the data. If you use infile, you will need to format the date fields in your input statement. Example: read in 3 fields; StoreID, Date1, Date2. Use a : prior to the MMDDYY10. to specify the input format in the input statement.
INPUT StoreID $ Date1 :MMDDYY10. Date2 :ANYDTDTE10. ;
An example is included in your SAS Studio shared folder, READDATES.SAS
read more on SAS Date formats
Create a SAS script and read the datasets into SAS PERMANENT data sets for analysis. The permanent data sets should be stored in a library. Create the library using LIBNAME.
- train.csv
- test.csv
- stores.csv
- features.csv
Tips
To make this work you’ll need to have these steps completed. You will be reading in a permanent data set that is stored in a folder on your account. You can use the library to specify the data set location using the mylib.dataset notation.
- Create a folder in your SAS account to store your permanent data sets. (right click on FILES (HOME) in your SAS Studio account, NEW, Folder)
- Create a library using the LIBNAME statement, the path for the library should be a location in your account used to store the permanent data set. Find the path by right clicking on the folder created in step 1, then select properties, copy the path into your LIBNAME statement. Ex: LIBNAME mylib “/home/u39156544/Myfiles”; where the path in quotes is copied from your Myfiles folder properties. You can name the folder and library anything you want, this is just an example.
- Use the library name created in step 2 in your code line 2 mylib.train where mylib is the library name from step 2.
- Make sure you have a permanent data set created from each external file. Use infile or import to import the data from the external file into each permanent data set.
Submitting your work
Please submit ONE word doc with the following to the dropbox:
- Text of each SAS Script code (not a screenshot, I need to be able to run your code). You can include one document with all code included, clearly label each script.
- A screenshot of each SAS script OUTPUT, clearly labeled.