Using code to open a dataset, either one you have downloaded or inputted manually, in Sas is rather easy!
Once you have the data downloaded onto your computer the next step is to tell Sas the location of the data, so it knows where to pull it from. You can find the path of a file by left clicking on the file, going to properties, and copying/pasting the path into the Sas code file.
Below is code for opening a data file in Sas. Note: Sas data files are saved as a ".sas" file.
In the code above we are using a PROC (procedure) to IMPORT the DATA SLID from the DATAFILE located on the pathway "C:\Users\Username\Sas\SLID.dat" that is stored on the computer. At the end we are telling Sas to RUN this section of code.
If you have collected data and need to begin manually inputting it into Sas, we can use code to create a new dataset. Below is some example code on how to add data.
In the code above we are creating new DATA called example_dataset. We INPUT the variables wages, education, age, sex $, and language $ (Note: a " $ " appears after the variable sex and language indicating to Sas that it is a factor variable). Next, we add DATATLINES where each line is a new observation with each datum point corresponds to the columns above. Finally, we finish this code with the RUN command.
The output is simply the code above. Sas only gives us this output to tell us the code ran correctly and there are no issues.