Q. How to convert a Excel sheet in SAS as source ?
A. We cannot use Excel as a source directly in SAS. It has to be converted to a SAS Data Set and only then can be used in your SAS Analysis.PROC IMPORT is the function which is used to convert the excel data to SAS Subset
Code for importing Excel data and using it as SAS Subset.
Here below I am creating a BOX PLOT using Excel data.
FILENAME REFFILE ‘/home/jethina0/SAS_Codes/case0101.csv’;
PROC IMPORT DATAFILE=REFFILE
proc sort data=work.imports; by descending source;run;
PROC PRINT DATA=WORK.IMPORTS; RUN;
PROC BOXPLOT DATA=WORK.IMPORTS;
Q. How to create a Subset of Data in SAS ?
A. Subset of data can be created by using the IF and WHERE Statements
PROC PRINT DATA=SMALL N=’Total number of cars :’
title “This is a SMALL Subset”;
Here Engine Size is the filter condition used to create the Subset
Q. What are the different ways to call a data in SAS ?
A. There are multiple ways to do it. The basic one is as follows
- DATA MYDATA;
- PROC SORT DATA=”/home/jethina0/somedata” out=sort1;by descending id;
PROC PRINT data=sort1 ; RUN;
- PROC PRINT DATA =’/home/jethina0/somedata’;