You are on page 1of 4

DATA TEST;

X=10;

RUN;

PROC PRINT DATA=TEST;

RUN;

PROC CONTENTS DATA=SASHELP.CLASS; * CONTENTS KEYWORD FOR VIEWING THE DISCRIPTOR


PORTION OF THE DATASET;

RUN;

PROC PRINT DATA=SASHELP.CLASS NOOBS;

VAR NAME AGE;

RUN;

DATA TEST;

MARKS=100;

GENDER='m';

NAME='GEORGE';

RUN;

PROC CONTENTS DATA=TEST;

RUN;

PROC PRINT DATA=test;

RUN;

PROC CONTENTS DATA=SASHELP.BUY; *

RUN;

PROC PRINT DATA=SASHELP.BUY;

RUN;

***************************date;

DATA DATE;

DATE= TODAY();

RUN;

PROC PRINT DATA=DATE;


*FORMAT DATE DDMMYY10.;

*FORMAT DATE WEEKDATE.;

FORMAT DATE MONYY7.;

RUN;

************************user_defined formats;

PROC FORMAT;

VALUE $GENDERFMT 'F'='FEMALE'

'M'='MALE' ;

RUN;

PROC print data= sashelp.class;

format sex $genderfmt.;

run;

PROC CONTENTS DATA=SASHELP.air; *

RUN;

PROC PRINT DATA=SASHELP.air;

RUN;

***user_defined labelled formats *****ONLY LESS THAN SYMBOL IS USED *** USEFUL FOR
FREQUENCY DISTRIBUTION;

proc format;

value airfmt low-<100='tier 1' 100-<200='tier 2' 200-<400='tier 3' 400-high='tier 4';

run;

proc print data=sashelp.air;

format AIR airfmt.;

run;

proc freq data=sashelp.air;

tables air ;

format air airfmt.;

run;

*****TASK***subsetting of a dataset USING 'set' keyword *** where for **;


data New;

set sashelp.air;

where air<250;

Air2=air*0.3;

if air2>40;

run;

proc print data=New;

run;

proc contents data=sashelp.class;

run;

data newclass;

set sashelp.class;

drop sex weight;

where sex='F' and age>10;

run;

proc contents data=newclass;

run;

proc print data=newclass;

run;

**IMPORTING FILES**;

libname astha 'C:\income and saving.csv';

**HOW MANY DATASETS ARE THERE IN YOUR LIBRARY***nods=no descriptor**;

proc contents data=sashelp._all_ nods;

run;

*****SAS NAME LITERALS****;

proc contents data=Astha.'australia$'n;


run;

proc print data=Astha.'australia$'n;

run;

*****DISCONNECT LIBNAME CONNECTION WITHOUT PHYSICALLY CLOSING*****:

libname astha clear;