How to Upload a Data Set to Sas
After your datafiles accept been uploaded to your SAS OnDemand for Academics business relationship, you can import the data into a SAS data stride. The easiest way to practise so is to employ the Import Data task:
-
Click Tasks and Utilities in the Navigation pane, then click Import Data.
This will create a new tab in the work area, titled Import Data 1.
-
You can decide to drag and driblet your files or select a file to import. In our case, the Excel file with the sample information is located in our Sample data folder. (Remember: when using SAS OnDemand for Academics, your information must be uploaded into theServer Files and Folders tab. If yous do not run across any data files in this window, yous well-nigh probable need to upload them; see the previous department on uploading data to SAS ODA.)
-
Once you lot've called the Excel file with the information, click Open up. SAS will populate the file information and generate code for importing.
-
To run the code, click the Run button (running human being icon) to execute the code.
-
Once y'all've executed the code, bank check the Log to run across if any errors have occurred. If successful, the Log window should tell us how many observations and variables the new dataset contains.
Additionally, you lot tin can preview the dataset in the Output Data tab.
-
If you are satisfied with the effect of the import process, y'all have the option to relieve the Import job past clicking the Relieve push button (floppy disk icon). This volition create a *.ctl file in your SAS ODA account, which you can use to repeat/re-create the import process in the future. We highly recommend doing this so you lot take a tape of how you lot imported the data.
Understanding the Import Syntax
Permit's take a closer look at the syntax that SAS generates when using the Import tool and empathize what each line is doing:
The first four lines are comments -- they do not contain executable code, and be only as notes for human being readers. The notes incorporate the name and location of the imported file, and the date that the import lawmaking was generated.
The outset executable line of code is
%web_drop_table(Piece of work.IMPORT);
This item command "clears out" any data in the system saved under the Piece of work.IMPORT name. You lot might notice that this control looks very different than the PROC IMPORT and PROC CONTENTS commands. Discover the percent symbol (%) at the commencement of the line: this tells us that %web_drop_table
is a user-defined macro command. In this example, it'southward a part that SAS themselves defined to quickly delete a particular dataset. If you lot've imported another dataset into SAS using the Import task under the proper name Work.IMPORT and want to keep it, brand certain you save it nether a proper name other than WORK.IMPORT, or else you lot will lose it!
The starting time pertinent line starts with the FILENAME
argument, which specifies the path to the file containing the data to import. In item, information technology assigns the nickname REFFILE to the total file path where our data is located. This means that we can simply type the nickname REFFILE in the PROC IMPORT
step instead of having to write out the full file path.
The next block of code is the PROC IMPORT
statement, which triggers the data import action. Annotation the first semicolon is not until the third line. This is because the syntax includes quite a few options associated with the PROC IMPORT
argument:
- The
OUT
option tells SAS where to put the new SAS dataset information technology is creating – in this case nosotros told information technology to put the new SAS dataset "import" in the Work library. - The
DATAFILE
option points to the file directory of the dataset you are importing. - The
DBMS
option tells SAS what engine to use to read the data (in this case, the XLSX engine). This value will depend on what blazon of file y'all're importing. -
GETNAMES=YES
instructs SAS to use the first row of the file every bit variable names.
The PROC IMPORT code in this step is very similar to the PROC IMPORT lawmaking ane would use for "desktop" SAS, so for more information about PROC IMPORT, see our Importing Excel Files into SAS tutorial.
Post-obit the PROC IMPORT
control, SAS generates code for PROC CONTENTS
, which displays data well-nigh the newly-imported dataset (WORK.IMPORT).
PROC CONTENTS is a standard SAS procedure; for more information well-nigh how to use and empathise it, see the Summarizing Dataset Contents with PROC CONTENTS tutorial.
Source: https://libguides.library.kent.edu/SAS/OnDemandImportData
0 Response to "How to Upload a Data Set to Sas"
Publicar un comentario