Rules for SAS file name and variable name

Ratings:
(4)
Views:0
Banner-Img
  • Share this blog:

Rules for SAS file name and variable name:

  • We can give up to 32 characters
  • Names start with letters or under score(_)
  • We can use letters and numbers
  • We can’t use any special characters except under score.

 

Data set block:

 Note: Data set block start with data key board and requires the name of the SAS file.  

In file statement:

    It is accessing statement, it accept data from internal files or external files.

  • If it is a internal data, in file statement followed by cards.
  • If it is a external data, in file statement followed by file location.

 

Input statement:

It is a reading and loading statement in SAS file with variables.  

Cards statements (or) data lines:

These 2 statements are used to indicate the internal data. Note: Data set block closed with ; (or) run statement. Each and every SAS statement ends with ; SAS coding can be written in mixed case. Capture   To run the SAS file use F3 (or) F8 Ex: 100   kumar 34 black 101   kiran 89 white Capture     Delimiter: In raw data, data values are represented by any one special character. This special character is called delimiter. Default delimiter in SAS is space.

These core tutorials will help you to learn the Rules for SAS file name and variable name. 
For an in-depth understanding and practical experience, explore SAS Training Material.

Single level of data set name:

Ex: data demo If use the single level of data set name, the data set default stores in work library.

 

Two levels of data set name:

Using 2 levels of data set name, we can store data set in requirwd name. Ex: Data sasuser. demo; Capture   TE: if we write single level of data set name SAS fault convert into 2 levels of data set name.

 

Libraries:

It is a storage place for SAS files.

 

SAS file (or) SAS data set:

It stores the data in variables and observation format.

  • Each and every column is variable
  • Each and every row is observation.
  • Each and every data is data value.

Capture    

Requirements for SAS file:

  1. Raw data - Numeric

Character

  1. Name of the SAS file
  2. Variables

  Numeric: +And -, decimal (or) E for scientific notation.   Character:    Numerals, letters or special characters($ or!) up to 32,767 characters long Libraries are 3 types

  1. Work
  2. SAS user
  3. SAS help

  Work: Default destination of SAS file is work library. If we store any data set in work library, it is available at the end of SAS session. Work is temporary storage place for SAS file. SAS user and SAS help: Both are the permanent storage place for SAS files, But in SAS user only. user specified files are available , but in SAS help users specified file and system (SAS) specified files are also available.   File: This concept is used to create a shortcut for external files from outside of SAS environment to SAS environment. Favorites and folders: This concept is used to crate a short cut for folders. Result window: It is used to manage a SAS application result. In SAS, output window is managed by a result window.   SAS/BASE This is one of the modules in base SAS tool. It is used to create a SAS file(SAS dataset)   SAS file requirements:

  1. Raw data
  2. Name of the SAS file
  3. Variables 

  Raw data:   It is 2 types

  1. Internal data
  2. External data

  Internal data:         If raw data is available in SAS environment (editor window). This raw data is called internal data.   External data: It is available in outside of the SAS environment or external files like txt, excel, oracle…. Capture       Length statement:    Using length statement, we can increase the storage for character variable. We can increase the storage capacity up to 256 characters.   Number storage: SAS  system default store upto 12 numbers. Numeric value grater than 12 numbers stores in scientific format. We can convert scientific format into normal format using format statement. Ex: Data sasuser.demo; Infile cards; Length name $ 12; Input pid age name $ race $ Height; Cards; 123 34 kiran rao Asian 5.6 201 59 pavan kumar Africa 3.4 202 23 lava kumar Asian 4.5  

Named input method:

Some times in raw data, data values available with variables names. In this case, we can use named input method. Ex: Data demo 1; Infile cards; Length name $13; Input pid = age = name = $; Cards; Pid = 123  age =34 name kiran rao Pid =201  age=59  name= pavan kumar Pid =202  age =23  name = lava kumar ; Proc print data = demo1; Run;  

Column input method:

In raw data, data values are available in specific columns.   Procedure block:   Using procedure block, we can analysis and reporting. It starts with PROC keyword and requires procedure options. It is closed with run or quit statement. Note: Default procedure block generate in output window Ex: Data sasuser.demo; Infile cards; Input pid age color $ race $ Height weight; Cards; 200  34 white Asian 5.6 78 201  59 black Afirica 3.4 45 202 23 white Asian 4.5 56 ; Proc print data = sasuser demo; Run;

                       

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox