List Input:
 List input is used to read the data but we cannot jump to reading specific variables.
Column Input:
 Column input is used to read the missing values present in list input but it does not
handle non-standard data.
Formatted Input:
 Formatted input is used to read the non-standard form of data from column input.
Export:
 Reading the sas dataset into any other format of file.
Import:
 Reading outside data files into sas dataset.
Keep:
 It keeps the wanted variables from existing data set.
Drop:
 It helps to drop the unwanted variables from existing data set.
Rename:
 It is used to rename the variables.
Set:
 It is an command used to set the required variables from existing dataset to new
dataset.
Put:
 It is a command to write the values in a specified manner.
Missover:
 Sets values to missing if an input statement would read more than one line.
Stopover:
 Same as missover but declare errors.
File:
 Helps to locate external file with specified data set.
Infile:
 Helps to get data from external file into sas data set.
Libname:
 It helps to create the permanent data set in to specified location of the system.
Input:
 It reads the raw data from in stream data lines or external files into a sas data set.
Dlm:
 Excludes the delimiters from given raw data into sas dataset.
Where:
 It is a condition statement used to select specified data items into a dataset. It can
be used at statement level/data level/set level.
If:
 It is a condition statement used to select specified data items into a dataset but it
cannot be used at set level/data level/proc level and only used at statement level.
Contents:
 It is used to display the total contents of dataset such as total number of
observations, type, format, sorted information etc..
Select :
 It is used to select specific variables by satisfying all given conditions.
Copy:
 It is used to copy the data sets from one library to another library
Delete:
 It is a command used to delete the datasets present in library.
Proc datasets:
 It is a proc level command used to perform the delete, copy, select, kill,etc
operations on existing data sets.
Proc sort:
 It is proc level command used to sort the data of dataset in order.
Nodup:
It removes duplicates for checking entire variables.
Nodupkey:
 It removes duplicates by values irrespective of other variables.
Proc sql:
 It is a command used to work with sql operations on data set.
Merging:
 It is a concept used in sas to merge two or more datasets into one dataset, but it is
done only after sorting because of that it takes more execution time.
Joining:
 It is a concept used in sql to join two or more tables into one table without sorting
the data, so it takes less execution time.
Diff b/w proc means & proc summary?
Proc means:
 By default it prints the complete information of the data set i,e no. of obs, min,
max,std dev,mean values in the existing dataset.
Ex: proc means data=sashelp.class;run;
Proc summary:
 By default it prints only no. of observations in the existing dataset.
Ex: proc summary data=sashelp.class print;run;
Proc univariate:
 It is a command used to display the descriptive statistical measures like mean,
median, mode, skewness, coef variation etc..
Proc freq:
 It is used to display variable wise frequency, cumulative frequency, per cent,
cumulative percent values of the given data set.
What is sas?
 Sas is Statistical analytics software. Sas is a fourth generation language deals with
statistical data analysis, management, retrieving data, and generating reports.
What is pdv?.
 PDV is program data vector which resides the back ground of sas, and acts as buffer.
It consists of two phases compilation phase and execution phase. In compilation
phase it checks the syntax, semantics, length and type of variables and generates
errors. In execution phase it takes one observation at a time from top to bottom
gives correct output without errors.
Sub str & concatenation:
 It is useful to read the given text from specific position to number of positions.
Ex: data abc1;
name=substr('vinod',1,2)||substr('kumar',2,3);
/*sbs=substr(name,1,2);*/
run;
proc print;run;
Scan:
 It is useful to read the specific word from given text.
Ex: data abc2;
name=scan('vinod kumar',2);
run;
proc print;run;
Intnx:
 INTnx is useful to increment the given date in month, day, and year by specific
intervals.
Intck:
 INTck is useful to see the difference in 2 dates in month, year and days.
Ex:
data vinod;
x=intnx('month',today(),0);
y=intnx('month',today(),-1);
z=intnx('month',today(),3);
d1=intnx('day',today(),0);
d2=intnx('day',today(),-1);
d3=intnx('day',today(),3);
y1=intnx('year',today(),0);
y2=intnx('year',today(),-1);
y3=intnx('year',today(),3);
run;
proc print data=vinod;
format x y z d1 d2 d3 y1 y2 y3 mmddyy10. ;
run;
intck() ex:
data ub;
informat dob doj date9.;
input dob doj;
day_diff=intck('day',dob,doj);
mon_diff=intck('month',dob,doj);
year_diff=intck('year',dob,doj);
day_incrmt=intnx('day',dob,2);
mon_incrmt=intnx('month',dob,2,'E');
/*mon_incrmt=intnx('month',dob,2);*/
year_incrmt=intnx('year',dob,3);
if day_diff > 45 then bonus=10;else bonus=10-3;
/*in insurance we use conditions like this*/
cards;
26Jan1991 10aug2013
09feb1980 10apr1999
;
run;
proc print;
format dob doj date9.;
format day_incrmt mon_incrmt year_incrmt date9.;
run;
Difference b/w input and put function?.
Input(): It is a function returns character values to numeric .
Ex: data abc;
Input sale $9.;
Formatsale=input(sale,comma9.)
Cards;
1,25,5544;
Run;
Put(): It is a function returns numeric values to character.
data testin;
input sale $9.;
fmtsale=input(sale,comma9.);
sasdate=put(fmtsale,date9.);
datalines;
2,11,5353
;
proc print;run;
Proc transpose:
To transpose the data rows in to cols and cols into rows.
Ex:
data a;
input country $ month $ sales;
cards;
india jan12 100
india feb12 200
india mar12 300
india apr12 400
india may12 500
india jun12 600
india jul12 700
india aug12 800
india sep12 900
india oct12 1000
india nov12 1100
india dec12 1200
;
run;
proc transpose data=a out=b;
id month;
var sales;
by country;
run;
proc print data=b;run;
Proc transpose:
To transpose the data rows in to cols and cols into rows.
Ex:
data a;
input country $ month $ sales;
cards;
india jan12 100
india feb12 200
india mar12 300
india apr12 400
india may12 500
india jun12 600
india jul12 700
india aug12 800
india sep12 900
india oct12 1000
india nov12 1100
india dec12 1200
;
run;
proc transpose data=a out=b;
id month;
var sales;
by country;
run;
proc print data=b;run;

Sas basis imp intrw ques

  • 1.
    List Input:  Listinput is used to read the data but we cannot jump to reading specific variables. Column Input:  Column input is used to read the missing values present in list input but it does not handle non-standard data. Formatted Input:  Formatted input is used to read the non-standard form of data from column input. Export:  Reading the sas dataset into any other format of file. Import:  Reading outside data files into sas dataset. Keep:  It keeps the wanted variables from existing data set. Drop:  It helps to drop the unwanted variables from existing data set. Rename:  It is used to rename the variables. Set:  It is an command used to set the required variables from existing dataset to new dataset. Put:  It is a command to write the values in a specified manner. Missover:  Sets values to missing if an input statement would read more than one line. Stopover:  Same as missover but declare errors. File:  Helps to locate external file with specified data set. Infile:  Helps to get data from external file into sas data set.
  • 2.
    Libname:  It helpsto create the permanent data set in to specified location of the system. Input:  It reads the raw data from in stream data lines or external files into a sas data set. Dlm:  Excludes the delimiters from given raw data into sas dataset. Where:  It is a condition statement used to select specified data items into a dataset. It can be used at statement level/data level/set level. If:  It is a condition statement used to select specified data items into a dataset but it cannot be used at set level/data level/proc level and only used at statement level. Contents:  It is used to display the total contents of dataset such as total number of observations, type, format, sorted information etc.. Select :  It is used to select specific variables by satisfying all given conditions. Copy:  It is used to copy the data sets from one library to another library Delete:  It is a command used to delete the datasets present in library. Proc datasets:  It is a proc level command used to perform the delete, copy, select, kill,etc operations on existing data sets. Proc sort:  It is proc level command used to sort the data of dataset in order. Nodup: It removes duplicates for checking entire variables.
  • 3.
    Nodupkey:  It removesduplicates by values irrespective of other variables. Proc sql:  It is a command used to work with sql operations on data set. Merging:  It is a concept used in sas to merge two or more datasets into one dataset, but it is done only after sorting because of that it takes more execution time. Joining:  It is a concept used in sql to join two or more tables into one table without sorting the data, so it takes less execution time. Diff b/w proc means & proc summary? Proc means:  By default it prints the complete information of the data set i,e no. of obs, min, max,std dev,mean values in the existing dataset. Ex: proc means data=sashelp.class;run; Proc summary:  By default it prints only no. of observations in the existing dataset. Ex: proc summary data=sashelp.class print;run; Proc univariate:  It is a command used to display the descriptive statistical measures like mean, median, mode, skewness, coef variation etc.. Proc freq:  It is used to display variable wise frequency, cumulative frequency, per cent, cumulative percent values of the given data set. What is sas?  Sas is Statistical analytics software. Sas is a fourth generation language deals with statistical data analysis, management, retrieving data, and generating reports.
  • 4.
    What is pdv?. PDV is program data vector which resides the back ground of sas, and acts as buffer. It consists of two phases compilation phase and execution phase. In compilation phase it checks the syntax, semantics, length and type of variables and generates errors. In execution phase it takes one observation at a time from top to bottom gives correct output without errors. Sub str & concatenation:  It is useful to read the given text from specific position to number of positions. Ex: data abc1; name=substr('vinod',1,2)||substr('kumar',2,3); /*sbs=substr(name,1,2);*/ run; proc print;run; Scan:  It is useful to read the specific word from given text. Ex: data abc2; name=scan('vinod kumar',2); run; proc print;run; Intnx:  INTnx is useful to increment the given date in month, day, and year by specific intervals. Intck:  INTck is useful to see the difference in 2 dates in month, year and days. Ex: data vinod; x=intnx('month',today(),0); y=intnx('month',today(),-1); z=intnx('month',today(),3); d1=intnx('day',today(),0); d2=intnx('day',today(),-1); d3=intnx('day',today(),3); y1=intnx('year',today(),0); y2=intnx('year',today(),-1); y3=intnx('year',today(),3); run; proc print data=vinod;
  • 5.
    format x yz d1 d2 d3 y1 y2 y3 mmddyy10. ; run; intck() ex: data ub; informat dob doj date9.; input dob doj; day_diff=intck('day',dob,doj); mon_diff=intck('month',dob,doj); year_diff=intck('year',dob,doj); day_incrmt=intnx('day',dob,2); mon_incrmt=intnx('month',dob,2,'E'); /*mon_incrmt=intnx('month',dob,2);*/ year_incrmt=intnx('year',dob,3); if day_diff > 45 then bonus=10;else bonus=10-3; /*in insurance we use conditions like this*/ cards; 26Jan1991 10aug2013 09feb1980 10apr1999 ; run; proc print; format dob doj date9.; format day_incrmt mon_incrmt year_incrmt date9.; run; Difference b/w input and put function?. Input(): It is a function returns character values to numeric . Ex: data abc; Input sale $9.; Formatsale=input(sale,comma9.) Cards; 1,25,5544; Run; Put(): It is a function returns numeric values to character. data testin; input sale $9.; fmtsale=input(sale,comma9.); sasdate=put(fmtsale,date9.); datalines; 2,11,5353 ; proc print;run;
  • 6.
    Proc transpose: To transposethe data rows in to cols and cols into rows. Ex: data a; input country $ month $ sales; cards; india jan12 100 india feb12 200 india mar12 300 india apr12 400 india may12 500 india jun12 600 india jul12 700 india aug12 800 india sep12 900 india oct12 1000 india nov12 1100 india dec12 1200 ; run; proc transpose data=a out=b; id month; var sales; by country; run; proc print data=b;run;
  • 7.
    Proc transpose: To transposethe data rows in to cols and cols into rows. Ex: data a; input country $ month $ sales; cards; india jan12 100 india feb12 200 india mar12 300 india apr12 400 india may12 500 india jun12 600 india jul12 700 india aug12 800 india sep12 900 india oct12 1000 india nov12 1100 india dec12 1200 ; run; proc transpose data=a out=b; id month; var sales; by country; run; proc print data=b;run;