KW - data - to create a new SAS data set eg: data GET_DATA; infile - input file eg; infile 'filepath' dlm=',' dsd missover firstobs=2; dsd missover firstobs - allow SAS to deal with missing values dsd - 2 succesive delimiters indicates a missing value eg: a,b,,d - ignore delimiter within quotes eg: "david, Jr" missover- to skip over missing values i.e return a mising value firstobs=2 - start reading data from row 2 informat - to indicate that data in source file is in a particular format eg: in format var_name mmddyy8; length - by default limit 8 eg:length var_name $20; input - order of var same as in source file eg: input var_name1 $ var_name2; - $ after char var - var name need not be the same as in source file, up to user to fix var name format - display in particular format in the SAS data set eg:format var_name dat e9; C1 - 4 log is in output explorer Storage - SAS datasets stored in work in libraries under local under server expl orer tab by default (stored temporarily - only during session) - dataset ->click on data -> column properties -> will attributes of dat a - if only want to view dataset, no need for 'proc print' - better to vie w from work folder KW - set - eg: data getdata2; set getdata1; - the data for getdata2 must come from getdata1 - IF - eg: data getdata2; set getdata1; if var_name = 'x'; - only those data from getdata1 would be copied to getdata2 whose var_na me is 'x' - getdata2 would have the same number of var but fewer rows of data if a ll not = x c1 - 5 permanent datasets and libraries - create library using 'libname' statement eg: libname FIRSTPRJ(<=8) "already existing folder location" - now create dataset in this library eg: libname FIRSTPRJ(<=8) "already existing folder location" data FIRSTPRJ.getdata1; eg: similarly for set statement
- can be seen under libraries now in server explorer
default naming convention for dataset - libname.datasetname for permanent dataset eg: data forstprj.getdata1; new session - no firstprj can be seen - to retrieve permanent dataset -> simply run libname firstprj "location" and ge tdata1 will appear (all datasets stored in loc will show up. no need to impo rt again) eg: data second.getdata2; set firstprj.getdata1; -> this would create getdata2 ds in lib second c1 - 6 PROC import -to convert a non SAS data set to SAS dataset. if SAS, use set eg: proc import datafile ="file location" out = dataset_name (create a dataset of the foll name) dbms = csv; (dbms equivalent to dlm) run; -not specifying var -not specifying attributes -bcos SAS determines data types by looking at first 20 rows of data -> problemat ic with mixed data it auto-generates the code in the log proc import options -getnames -datarow -guessingrows (default is 20) -replace - instructs SAS to overwrite existing dataset c1 - 7 GUI import - file -> import wizard ------------------------------------------------------------------------------------------------------------------log - execution history kw - commands understood by sas .sas7bdat - dataset