Clinical SAS Programming Training Course for free 👌👌 || SAS Programming Tutorial for True Beginners👍
Clinical SAS Programming Training Course for free SAS Programming Tutorial for True Beginners, how to learn Clinical SAS Programming course for free
Key Points from Module No -1:
SAS Programming Rules:
----
- SAS Program Comprises of One or More SAS Statements.
- Statement: Its Generally Starts with SAS Keyword and Ends with Semicolon ';'.
- Multiple Statements Can Be Present in a Single Line.
- Single Statement We can Spread Across Multiple Lines.
- You can Start Any position and You can end anywhere you like
- SAS Keywords not Case Sensitive/Data Values Always Case Sensitive
- SAS Has its own Keywords
SAS Terminology:
-------
Table -- SAS Dataset
Columns -- Variables
Rows --Observations
SAS Program Consists Of 2 Steps:
Data Step:
----------
- Its Generally starts with keyword called "DATA" ends with "Run".
- To Create(Manage) SAS Datasets
Proc Step
---------
- Its Generally starts with keyword called "PROC" ends with "Run".
- To Process(Analysis) SAS Datasets
**
Ways Of Creating SAS Datasets
**
1.Input and Datalines - Raw Data
*****
SyntaX:
------
Data Dataset_name;
Input Var1 var2$ var3 Var4$..;
Datalines;
. . .
. . .
. . .
;
Run;
---
Data : To Assign ouput dataset/table name
Input: By using input we can set variables/columns and its attributes
Datalines/cards/lines: To specify observations/rows
Run: To execute previously entered sas statements
----
By default SAS will consider all variables as numeric variables
- Numeric variable can able to read only Numerics (0 - 9) + - .
To tell SAS about character variable just use dollar symbol($) after the variable name
- Character variables can read Anything(All alphabets, All spl chars,All Numerics)
SAS Default delimiter Space
SAS Will treat multiple delimiters as single delimiter
When there is missing values in your data,if space is delimiter to indicate missing values
Just use Period(.)
Other than space delimiter to indicate missing values
Either we can use Space or Period(.)
- Character missing values for output dataset (Blank Space)
- Numeric Missing values for output Dataset(Period(.))
----
2. SET Statement - SAS Dataset
**
- To copy data from one or more SAS Datasets to create a Datasets
---
Data Output_dataset_name;
set Input_Data_name ;
run;
**
SAS Varaibles
***
- Character Variables
- Numeric Variables
******
PARAMETER CHARACTER NUMERIC
********
Data Type = All Alphabets,All Spl chars | Only Numerics ( 0 - 9 )
All Numerics + - .
-----
Ex: John@123,1245000,Meghana,@##$$%| Ex: +98.54 , -2.3 ,1250000000
***
Default Length = 8 Bytes (8 Characters) | 8 Bytes (12 Numbers)
----
More than 8 chars : Trucation | More than 12 nums : 'E' Format
----
LENGTH stmt = MIN - 1 MAX - 32767 | MIN - 3 MAX - 8
-----
Missing Values = Blank Space | Period(.)
*****
- By Using " LENGTH " Statement we can change length for Character variables
- By using 'RETAIN' Statement we can change variable order any wany you want
Naming Rules:
*********************
- The Dataset/Variable/Library Names should starts with alphabet or undescore(_) only
- The Dataset/Variable/Library Names should not starts with Numbers and Spl characters
- The Dataset/Variable/Library Names should Not contain Spl chars any position /except Underscore(_)
- The Dataset/Variable/Library Names can Contain Numbers other than 1st Position
- The Dataset/Variable Names should Not exceed 32 Characters(Min - 1 , Max -32)
- Library name should not exceed 8 Characters
SAS Libraries:
****************
Library: It is a Physical location where SAS Stores all SAS Files
EX: - SAS Datasets
- Catalogs
- Formats
- Views
- Indexes
- etc...
Libraries are Classified in to 2 Types"
SAS Defined:
------------
- These will be created and maintained by SAS Foundation
- You have only Read access for these libraries and SAS Files
- You can not edit,delete,Modify or Save SAS Datasets
Ex: SASHELP,MAPSSAS...
User Defined:
-------------
- These will be created and maintained by User(Developer)
- You have full access for these libraries and SAS Files
- You can edit,delete,Modify or Save SAS Datasets
Ex: NEW, MY_WORK,My_LIB,BALU...
How to Create User Defined LibrarY:
-------
Syntax:
-------
libname libref 'Path';
Libname - It is a SAS Keyword to create used defined library
Libref - Library name and it should follow naming rules
Path - Physical Location
SAS Comments:
*****
- Comments provide related information about the Program
- Comments are not executable
How to make Comment:
-------
- Starts with /* ends with */
- Starts with * ends with Semicolon ;
- Shortcut for multiple lines comment CTRL+/
To Uncomment:
------
- Shortcut for uncomment CTRL+SHIFT+/