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:

  1. Click Tasks and Utilities in the Navigation pane, then click Import Data.

    Icons for creating and deleting tasks and refresh. Drop downs for My tasks, tasks, and utilities. Utilities includes options for import data, queries, and creating new SAS Program

    This will create a new tab in the work area, titled Import Data 1.

    Import Data program with split windows.

  2. 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.)

  3. 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.

    The settings for the Import Data tool.

  4. To run the code, click the Run button (running human being icon) to execute the code.

  5. 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.

    The standard Log Notes if importing data was successful. Will include number of observations and variables, as well as the time it took to run the import.

    Additionally, you lot tin can preview the dataset in the Output Data tab.

    A table of the output data in the output tab. Can select variable names to be displayed in the table.

  6. 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 code tab with automatically generated code.

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).

Results tab with the results of running the code for PROC CONTENTS.

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.

bondnevency.blogspot.com

Source: https://libguides.library.kent.edu/SAS/OnDemandImportData

0 Response to "How to Upload a Data Set to Sas"

Publicar un comentario

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel