SAS Base Programing: Syntax Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which function modifier adds alphabetic characters to the list of characters?

'a'

Which function modifier scans backward from right to left instead of from left to right, regardless of the sign of the count argument.

'b'

Which function modifier adds digits to the list of characters.

'd'

Which function modifier ignores the case of the characters.

'i'

Which function modifier causes all characters that are not in the list of characters to be treated as delimiters.

'k' That is, if K is specified, then characters that are in the list of characters are kept in the returned value rather than being omitted because they are delimiters. If K is not specified, then all characters that are in the list of characters are treated as delimiters.

Which function modifier adds punctuation marks to the list of characters.

'p'

Which function modifier ignores delimiters that are inside substrings that are enclosed in quotation marks.

'q' If the value of the string argument contains unmatched quotation marks, then scanning from left to right produces different words than scanning from right to left.

Which function modifier removes leading and trailing blanks from the word that SCAN returns.

'r' If you specify the Q and R modifiers, the SCAN function first removes leading and trailing blanks from the word. Then, if the word begins with a quotation mark, SCAN also removes one layer of quotation marks from the word.

Which function modifier adds space characters to the list of characters (blank, horizontal tab, vertical tab, carriage return, line feed, and form feed).

's'

Which function modifier trims trailing blanks from the string and charlist arguments.

't' If you want to remove trailing blanks from only one character argument instead of both character arguments, use the TRIM function instead of the SCAN function with the T modifier.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a macro variable reference. A. &<macro‐var> B. &'<macro‐var>' C. %<macro‐var> D. %'<macro‐var>

A. &<macro‐var>

Select the proper syntax to perform the following instructions: Specify the proper function that calculates the date differences between two dates in days. A. <var>=datdif(<Start_date>, <End_date>, <basis_n/m>); B. <var>=datdif('<Start_date>', '<End_date>'); C. <var>=yrdif('<Start_date>', '<End_date>'); D. <var>=yrdif(<Start_date>, <End_date>, <basis_n/m>);

A. <var>=datdif(<Start_date>, <End_date>, <basis_n/m>); Example: <var>=datdif(2,9,1976 , 8,19,2006, 30/360); or <var>=datdif(2,9,1976 , 8,19,2006, ACT/ACT); ACT specifies actual calendar dates rather than generalizing to 30 day months / 360 day years.

Select the proper syntax to perform the following instructions: Specify the proper function to specify a variable equaling the current day of the month listed as an integer. A. <var>=day(<SASdate>); B. <var>=qtr(<SASdate>); C. <var>=year(<SASdate>); D. <var>=wekday(<SASdate>); E. <var>=month(<SASdate>);

A. <var>=day(<SASdate>); DAY(<SASdate>) gives day of month (1 to 31) The <SASdate> above can be a variable, a numeric constant or a date constant.

Select the proper syntax to perform the following instructions: Specify the proper function used to search a character value for a specified string. A. <var>=index(<source>, <excerpt>); B. <var>=tranwrd(<source>, <target>, <replacement>); C. <var>=compress(<source> ,<characters>, '<modifier(s)>'); D. <var>=catx('<delimiter>', <string>, <string>);

A. <var>=index(<source>, <excerpt>); It searches from left to right, looking for the first occurrence of the string, and returns the position of the string's first character. If the string does not exist, it returns 0.

Select the proper syntax to perform the following instructions: Specify the proper function for finding the number of time intervals occurring in a given time span. A. <var>=intck('<interval>' , '<ddmmmyy>'d , 'ddmmmyy'd); B. <var>=intck('<interval>' , '<ddmmmyy>' , 'ddmmmyy'); C. <var>=intnx('<interval>', 'ddmmmyy'd, <increment>); D. <var>=intnx('<interval>', 'ddmmmyy', <increment>);

A. <var>=intck('<interval>' , '<ddmmmyy>'d , 'ddmmmyy'd); The type of INTERVAL (date, time, or datetime) must match the type of values used in (<interval>,<FROM>, <TO>) Example: <var>=intck('hours' , '5:00't , '6:00't); or <var>=intck('second','01jan2009:00:00:00'dt,'01jan2010:00:00:00'dt);

Select the proper syntax to perform the following instructions: Specify the proper function that produces trailing blanks. A. <var>=left(<string>); B. <var>=right(<string>); C. <var>=trim(<string>); D. <var>=compbl(<string>);

A. <var>=left(<string>); To remove those blanks the trim function can then be applied. Example: TRIM(LEFT(<var>)); NOTE: length of a TRIMMED Variable is the same as the untrimmed variable. Length is NOT trimmed. This is true for the left function as well.

Select the proper syntax to perform the following instructions: Specify the proper function that returns the value with 1st character upper case and the rest in lower cases. A. <var>=propcase(<string>); B. <var=>upcase(<string>); C. <var>=lowcase(<string>); D. <var>=allcaps(<string>);

A. <var>=propcase(<string>);

Select the proper syntax to perform the following instructions: Specify the proper function that extracts a character string from variables, specifically extracting the first word from the right. A. <var>=scan(<string>,-1); B. <var>=scan(<string>,1); C. <var>=substr(<string>,-1) D. <var>=substr(<string>,1)

A. <var>=scan(<string>,-1); If the count is positive, SCAN counts words from left to right in the character string. If the count is negative, SCAN counts words from right to left in the character string.

Select the proper syntax to perform the following instructions: Specify the proper function to specify a variable equaling the current time as an SAS time. A. <var>=time(); B. <var>=date(); C. <var>=datetime();

A. <var>=time(); time(); gives current time as a SAS time

Select the proper syntax to perform the following instructions: Specify a procedure to create an Excel file with SAS reading one observation at a time. A. Data <libref>.<filename>; Set <libref>.<filename>; if _n_=<value> then output; run; B. Proc <libref>.<filename>; Set <libref>.<filename>; if _n_=<value> then output; run; C. Data <libref>.<filename>; Set <libref>.<filename> if n=<value> then output; run; D. Data <libref>.<filename>; Set <libref>.<filename>; if n=<value> then output; run;

A. Data <libref>.<filename>; Set <libref>.<filename>; if _n_=<value> then output; run; (The _n_ variable is an automatic variable that is created in the Data step. SAS reads observations from input data sets one at a time. _n_ is the number of times the data step has read observations from the input data set. _n_ is not added to the created data set.)

Select the proper syntax to perform the following instructions: Specify the proper informat syntax to convert a date to an SAS date value. Assume the date is formatted mm/dd/yy. A. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> mmddyy8.; run; B. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> date7.; run; C. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> yymmdd8.; run; D. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> time5.; run; E. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> datetime20.; run;

A. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> mmddyy8.; run; if date was formatted dd/mm/yyyy would be mmddyy10.

Logical Operator Numeric Values For the following expressions state whether it equals true or false. A. If = 0 B. If = (.) C. If = any other number

A. False B. False C. True

Select the proper syntax to perform the following instructions: Specify a global file reference for ONE external raw data file or a folder of data files. A. Filename <fileref> '<filepath>'; B. Datafile <filename> '<filepath>'; C. Libname <fileref> '<filepath>'; D. Infile <fileref> '<filepath>';

A. Filename <fileref> '<filepath>'; example: FILENAME sal_txt 'C:\Math610\RawData\RawData_txt\ salesdatad.txt'; (NOTE: LIBNAME creates a reference to a folder, not to ONE SAS data set.)

Select the proper syntax to perform the following instructions: Specify a procedure that dissociates a libref. A. Libname <libref> clear; B. Libname <libref> stop; C. Libname <libref> end; D. Libname <libref> close;

A. Libname <libref> clear;

Select the proper syntax to perform the following instructions: Specify the proper syntax to close all ODS destinations. A. ODS _ALL_ CLOSE; B ODS LISTING CLOSE; C. ODS PDF CLOSE; D. ODS RTF CLOSE; E. ODS HTML CLOSE;

A. ODS _ALL_ CLOSE;

Select the proper syntax to perform the following instructions: Create a comment section. A. Open /<*> <Text> <*>/ Close B. Open <*>/ <Text> /<*> Close

A. Open /<*> <Text> <*>/ Close example: </<*>This is a comment<*>/>

Select the proper syntax to perform the following instructions: Option that controls the error when a format is not found. A. Options Fmterr | Nofmterr; B. Options Source | Nosource; C. Options Error = <n>; D. Options obs = Max;

A. Options Fmterr | Nofmterr; example: Options Fmterr; Options Nofmterr; (FMTERR means that processing will stop and an error will be returned. NOFMTERR means a warning is returned, processing continues and a default format is used. The default is FMTERR.)

Select the proper syntax to perform the following instructions: Select the global option for maximum number of observations to be read into a data set. A. Options Obs = Max; B. Options Firstobs = Max; C.Options Obs = <n>; D. Options Firstobs = <n>;

A. Options Obs = Max; This is the default (Obs = <n>; works as long as you already know the total number of observations in the set and chose that for N)

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a date time constant. A. data <libref>.<filename>; <var>= 'ddmmmyy:hh:mm:ss'dt; run; B. data <libref>.<filename>; <var>= 'ddmmmyy:hh:mm:ss'd; run; C. data <libref>.<filename>; <var>= ddmmmyy:hh:mm:sst; run; D. data <libref>.<filename>; <var>= 'ddmmyy:hh:mm:ss'dt; run;

A. data <libref>.<filename>; <var>= 'ddmmmyy:hh:mm:ss'dt; run; Example: data dtime; tdtm = '01NOV2010:19:12:11'dt; run;\ 'ddmmmyy:hh:mm'dt 'ddmmmyy:hh:mm:ss'dt 'ddmmmyyyy:hh:mm'dt or 'ddmmmyyyy:hh:mm:ss'dt Tip: Be sure to enclose the date time in quotation marks

Select the proper syntax to perform the following instructions: Specify the proper syntax to create an iterative do statement with a conditional clause. A. data <libref>.<filename>; set <libref>.<filename>; do <var1>= <value> to <value> while(<var2>=<value>); <statement1>; <statement2>; end; run; B. data <libref>.<filename>; set <libref>.<filename>; do <var1>= <value> to <value> while(<var2>=<value>); <statement1>; <statement2>; close; run; C. data <libref>.<filename>; set <libref>.<filename>; do <var1>= <value> to <value> while(<var2>=<value>); <statement1> <statement2>; end; run; D. data <libref>.<filename>; set <libref>.<filename>; do <var1>= <value> - <value> while(<var2>=<value>); <statement1>; <statement2>; end; run;

A. data <libref>.<filename>; set <libref>.<filename>; do <var1>= <value> to <value> while(<var2>=<value>); <statement1>; <statement2>; end; run; Example: data invest; do Year=1 to 25 while(Capital<250000); Capital+5000; Capital+(Capital*.075); end;

Select the proper syntax to perform the following instructions: Specify the proper syntax that sorts the data in the data step by <var1> so that it only displays the first observation instance of each value for <var1>. A. data <libref>.<filename>; set <libref>.<filename>; by <var1>; if first.<var1>; run; B. data <libref>.<filename>; set <libref>.<filename>; by <var1>; if <libref>.<var1>; run; C. proc sort data=<libref>.<filename> out=<libref>.<filename> nodupkey; by <var1>; run; D. proc sort data=<libref>.<filename> out=<libref>.<filename>; by <var1>; run;

A. data <libref>.<filename>; set <libref>.<filename>; by <var1>; if first.<var1>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax for a do statement. A. data <libref>.<filename>; set <libref>.<filename>; do; <statement1>; <statement2>; end; run; B. data <libref>.<filename>; set <libref>.<filename>; do; <statement1> <statement2>; close; run; C. data <libref>.<filename>; set <libref>.<filename>; do; <statement1>; <statement2>; run; D. data <libref>.<filename>; set <libref>.<filename>; do; <statement1>; <statement2>; loop; run;

A. data <libref>.<filename>; set <libref>.<filename>; do; <statement1>; <statement2>; end; run; NOTE: A simple DO statement is often used within IF-THEN/ELSE statements to designate a group of statements to be executed depending on whether the IF condition is true or false. Example: if years>5 then do; months=years*12; put years= months=; end; else yrsleft=5-years;

Select the proper syntax to perform the following instructions: Specify the proper procedure to give a permanent name to a variable. A. data <libref>.<filename>; set <libref>.<filename>; label = '<variable(s)>'; run; B. data <libref>.<filename>; set <libref>.<filename>; label = <variable(s)>; run; C. data <libref>.<filename>; set <libref>.<filename>; label '<variable(s)>'; run; D. data <libref>.<filename>; set <libref>.<filename>; label <variable(s)>; run;

A. data <libref>.<filename>; set <libref>.<filename>; label = '<variable(s)>'; run; (These labels will then be stored in the descriptor portion of the data set created. These LABELS will be in effect for any PROC PRINT statement provided the label option is specified. Any label statements inside a proc print statement, however, will be used in place of the labels in the permanent SAS data set.) NOTE: One can use PROC CONTENTS data = SAS‐data‐set; to see whether there is a permanent variable attribute assignment including labels.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a length of 3 for a numeric variable. A. data <libref>.<filename>; set <libref>.<filename>; length <var2> 3; if <var1>='LONG' then <var2>=5.566; run; B. data <libref>.<filename>; set <libref>.<filename>; length <var2> $ 3; if <var1>='LONG' then <var2>=5.566; run; C. data <libref>.<filename>; set <libref>.<filename>; length <var2> 4; if <var1>='LONG' then <var2>=5.566; run; D. data <libref>.<filename>; set <libref>.<filename>; if <var1>='LONG' then <var2>=5.566; length <var2> 3; run;

A. data <libref>.<filename>; set <libref>.<filename>; length <var2> 3; if <var1>='LONG' then <var2>=5.566; run; Length should be stated before a variable is encountered or will get: "Length of character variable <var2> has already been set. Use the LENGTH statement as the very first statement in the DATA STEP to declare the length of a character variable."

Select the proper syntax to perform the following instructions: Specify the proper syntax to convert a numeric variable to character having 7 characters, two of which are decimals. A. data <libref>.<filename>; set<libref>.<filename>; <newvar>=put(<numvar>,7.2); run; B. data <libref>.<filename>; set<libref>.<filename>; <numvar>=put(<newvar>,7.2); run; C. data <libref>.<filename>; set<libref>.<filename>; <charvar>=input(<newvar>,7.2); D. data <libref>.<filename>; set<libref>.<filename>; <newvar>=input(<charvar>,7.2);

A. data <libref>.<filename>; set<libref>.<filename>; <newvar>=put(<numvar>,7.2); run; $ is not needed before format if only numbers, which numeric variables are NOTE: The format MUST be a numeric format.

Select the proper syntax to perform the following instructions: Specify the proper procedure to merge two data sets. A. data <libref>.<filename>; merge <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; B. data <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; run; C. data <libref>.<filename>; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; run; D. data SASdataset; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; E. proc append base = <libref>.<filename> data = <libref>.<filename>; run;

A. data <libref>.<filename>; merge <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; Merge: Combines observations A match-merge requires at least one variable as a BY variable. Data sets in the merge statement MUST be sorted on the by variable. NOTE: Observations of the first data set are overwritten if they contain the same variable, with different values. Similar to one-to-one reading.

Select the proper syntax to perform the following instructions: Specify the proper function that returns the value 'rounded‐down' to largest integer smaller than the argument; A. floor(<argument>); B. round(<argument>,<round-off-unit>); C. ceil(<argument>); D. int(<argument>);

A. floor(<argument>);

Select the proper syntax to perform the following instructions: Specify a libname statement options for reading EXCEL files that sets the length of the longest character string to n, where n is between 256 and 32767. A. libname <libref> '<filepath>' dbmax_text=n; B. libname <libref> '<filepath>' mixed=yes|no; C. libname <libref> '<filepath>' scantext=yes|no; D. libname <libref> '<filepath>' getnames = yes|no; E. libname <libref> '<filepath>' scantime=yes|no; F. libname <libref> '<filepath>' usedate=yes|no;

A. libname <libref> '<filepath>' dbmax_text=n;

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS destination with a table of contents and contents frame files created with a relative URL link. A. ods <destination> body = '<folderpath><filename_b>' (url='<filename_b>') contents = '<folderpath><filename_c>' (url='filename_c') frame ='<folderpath><filename>'; ods <destination> close; B. ods <destination> body = '<folderpath><filename_b>' (url='<filename_b>') contents = '<folderpath><filename_c>' (url='filename_c') frame ='<folderpath><filename>' (url='<serverpath><filename_f>'); ods <destination> close; C. ods <destination> body = '<folderpath><filepath_b>' (url='<serverpath><filename_b>') contents = '<folderpath><filepath_c>' (url='<serverpath><filename_c>') frame ='<folderpath><filepath>' (url='<serverpath><filename_f>'); ods <destination> close; D. ods <destination> body = '<folderpath><filepath_b>' (url='<serverpath><filename_b>') contents = '<folderpath><filepath_c>' (url='<serverpath><filename_c>') frame ='<folderpath><filepath>'; ods <destination> close;

A. ods <destination> body = '<folderpath><filename_b>' (url='<filename_b>') contents = '<folderpath><filename_c>' (url='<filename_c>') frame ='<folderpath><filename>'; ods <destination> close; Example: ods html body = 'C:\Math610\report\areport4.html' (url='areport4.html') contents = 'C:\Math610\report\cont4.html' (url='cont4.html') frame ='C:\Math610\report\frame4.html' ods HTML close; This creates hyperlinks files that work as long as the files are located in the same folder. With this, you can move all three files to a new folder and have them still work. Do not use for frame=.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination with the option that embeds the title that is created by the TITLE statement in the output. A. ods excel file= '<filepath>' (embedded_titles='yes|no'); B. ods excel file= '<filepath>' (sheet_label='<value>'); C. ods excel (suppress_bylines='yes|no'); D. ods excel file= '<filepath>' (sheet_interval="bygroup"); E. ods excel file= '<filepath>' (sheet_name='<value>');

A. ods excel file= '<filepath>' (embedded_titles='yes|no');

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS destination specifying a style for HTML output. A. ods html body ='<filepath>' style = <style-option>; B. ods html body ='<filepath>' style = '<style-option>'; C. ods html body ='<filepath>' style <style-option>; D. ods html body ='<filepath>' where style = <style-option>;

A. ods html body ='<filepath>' style = <style-option>; Exmple: ods html body ='C:\Math610\Report\areport7.html' style = minimal; style only works for HTML output

Select the proper syntax to perform the following instructions: Specify a procedure that reads data from an external data source TXT file and writes it to a SAS data set. A. options validvarname=v7; Proc Import datafile='<filepath>' dbms=dlm out=<libref>.<filename> replace; delimiter='<delimitercharacter>'; getnames=<yes/no>; run; B. options validvarname=v7; Proc Import infile='<filepath>'; dbms=dlm; out=<libref>.<filename>; replace; delimiter='<delimitercharacter>'; getnames=<yes/no>; run; C. options validvarname=v7; Proc Import infile='<filepath>' dbms=dlm out=<libref>.<filename> replace; delimiter='<delimitercharacter>'; getnames=<yes/no>; run; D. options validvarname=v7; Proc Import datafile='<filepath>'; dbms=dlm; out=<libref>.<filename>; replace; delimiter='<delimitercharacter>'; getnames=<yes/no>; run;

A. options validvarname=v7; Proc Import datafile='<filepath>' dbms=dlm out=<libref>.<filename> replace; delimiter='<delimitercharacter>'; getnames=<yes/no>; run; example: options validvarname=v7; Proc Import datafile='C:\Math610\file.txt' dbms=dlm out=work.newfile replace; delimiter='&'; getnames=yes; run; (options validvarname=v7; forces SAS to convert spaces to underscores when it converts column names to variables. getnames=yes; statement generates variable names from the first row of data.)

Select the proper syntax to perform the following instructions: Specify the proper syntax to export generated data step code or generated SAS/access code. A. proc export data=<libref.><filename> outfile= 'filename' DBMS=<delimiter>; replace; run; B. proc export data=<libref.><filename> out= 'filename' DBMS=<delimiter>; replace; run; C. data=<libref.><filename> set= 'filename' DBMS=<delimiter>; replace; run; D. proc export data=<libref.><filename>; outfile= 'filename'; DBMS=<delimiter>; replace; run;

A. proc export data=<libref.><filename> outfile= 'filename' DBMS=<identifier>; replace; run; NOTE: If you do not specify a SAS data set to export, the EXPORT procedure uses the most recently created SAS data set. REPLACE option allows overwriting if outfile filename already exists. If a fileref is used you can omit outfile quotations <identifier> specifies file type for export or delmiter used to separate data for a DBMS file type

Select the proper syntax to perform the following instructions: Specify the proper syntax for the proc format option that allows you to create a SAS format from a SAS data set. A. proc format cntlout=<libref>.<filename>; select <format-name>; run; B. proc format out=<libref>.<filename>; select <format-name>; run; C. proc format cntlout=<libref>.<filename>; out <format-name>; run; D. proc format cntlout=<libref>.<filename>; out= <format-name>; run;

A. proc format cntlout=<libref>.<filename>; select <format-name>; run; You can then print <libref>.<filename> as a data set.

Select the proper syntax to perform the following instructions: Specify the proper syntax to specify a range so that the variable is formatted to '<label>' if it is in <value1> through <value2>. A. proc format; value $<formatname> '<value1>'-'<value2>'='<label>'; run; B. proc format; value $<formatname> '<value1>'='<label>'; run; C. proc format; value $<formatname> '<value1>','<value2>'='<label>'; run; D. proc format; value $<formatname> other='<label>'; run;

A. proc format; value $<formatname> '<value1>'-'<value2>'='<label>'; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency table that suppresses cell frequency. A. proc freq data=<libref>.<filename>; tables <var(s)>/nofreq; run; B. proc freq data=<libref>.<filename>; tables <var(s)>/nopercent; run; C. proc freq data=<libref>.<filename>; tables <var(s)>/norow; run; D. proc freq data=<libref>.<filename>; tables <var(s)>/nocol; run; E. proc freq data=<libref>.<filename>; tables <var(s)>/nocum; run; F. proc freq data=<libref>.<filename>; tables <var(s)>/list; run; G. proc freq data=<libref>.<filename> crosslist; tables <var(s)>/crosslist; run;

A. proc freq data=<libref>.<filename>; tables <var(s)>/nofreq; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a two-way, or cross-tabular, frequency report for <var1><*><var2> and <var1><*><var3>. A. proc freq data=<libref>.<filename>; tables <var1><*>(<var2> <var3>); run; B. proc freq data=<libref>.<filename>; tables (<var1> <var2>)<*>(<var3 <var4>); run; C. proc freq data=<libref>.<filename>; tables <var1><*><var2>; run; D. proc freq data=<libref>.<filename>; tables <var1>--<var3>; run; E. proc freq data=<libref>.<filename>; tables (<var1>--<var3>)<*><var4>; run; F. proc freq data=<libref>.<filename>; tables <var1><*><var2><*><var3>; run;

A. proc freq data=<libref>.<filename>; tables <var1><*>(<var2> <var3>); run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to display frequency counts of the data values in a SAS data set. A. proc freq data=<libref>.<filename>; run; B. proc summary data =<libref>.<filename> PRINT; C. proc contents data=<libref>.<filename>; run; D. proc means data=<libref>.<filename>; run;

A. proc freq data=<libref>.<filename>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to produce a statistics report only showing the middlemost values for the variables of the data set. A. proc means data=<libref>.<filename> median; run; B. proc means data=<libref>.<filename> n; run; C. proc means data=<libref>.<filename> mean; run; D. proc means data=<libref>.<filename> max; run; E. proc means data=<libref>.<filename> min; run;

A. proc means data=<libref>.<filename> median; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to display simple descriptive statistics that selects specific numeric variables to be processed in a SAS data set. A. proc means data=<libref>.<filename>; var <var(s)>; run; B. proc means data=<libref>.<filename>; by <var(s)>; run; C. proc means data=<libref>.<filename>; class <var(s)>; run; D. proc freq data=<libref>.<filename>; var <var(s)>; run;

A. proc means data=<libref>.<filename>; var <var(s)>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a new SAS data set consisting only of the summary statistics calculated by PROC MEANS. Use only mean and standard deviation. A. proc means data=<libref>.<filename>; var <var1> <var2> <var3>; output out=<libref>.<filename>; mean = <var1M> <var2M> <var3M> std = <var1std> <var2std> <var3std>; run; B. proc means data=<libref>.<filename>; var <var1> <var2> <var3>; output out=<libref>.<filename>; mean = <var1M> <var2M> <var3M>; std = <var1std> <var2std> <var3std>; run; C. proc means data=<libref>.<filename>; var <var1> <var2> <var3>; output out=<libref>.<filename>; median = <var1M> <var2M> <var3M> std = <var1std> <var2std> <var3std>; run; D. proc means data=<libref>.<filename>; var <var1> <var2> <var3>; output=<libref>.<filename>; mean = <var1M>, <var2M>, <var3M> std = <var1std>, <var2std>, <var3std>; run;

A. proc means data=<libref>.<filename>; var <var1> <var2> <var3>; output out=<libref>.<filename>; mean = <var1M> <var2M> <var3M> std = <var1std> <var2std> <var3std>; run; Example: PROC MEANS data=mylib.crew NOPRINT; VAR Hiredate salary; OUTPUT OUT = discrip mean = avghiredate avgsalary Median= medhiredate medsalary; Run; Use var to help ensure that the variables produced in the output align with the proper variables. If var is not used mean= and std= will just read variables from left to right in whichever order they come.

Select the proper syntax to perform the following instructions: Specify the proper syntax to specify a temporary format with <x> being a numeric character used to define the format character length. A. proc print data=<libref>.<filename>; format <var> <format><x>.<x>; run; B. proc print data=<libref>.<filename>; format = <var> <format><x>.<x>; run; C. data <libref>.<filename>; set <libref>.<filename>; format = <var> <format><x>.<x>; run; D. data <libref>.<filename>; set <libref>.<filename>; format <var> <format><x>.<x>; run;

A. proc print data=<libref>.<filename>; format <var> <format><x>.<x>; run; Format in the proc print will be temporary and only apply to the report. Will not change variables in the data set. For example if data set were printed without the format the format will not be applied.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a comma variable format with 10 characters two of which are decimals. A. proc print data=<libref>.<filename>; format <var> comma10.2; run; B. proc print data=<libref>.<filename>; format <var> comma8.2; run; C. proc print data=<libref>.<filename>; format <var> comma102; run; D. proc print data=<libref>.<filename>; format <var> comma 10.2; run;

A. proc print data=<libref>.<filename>; format <var> comma10.2; run;

Select the proper syntax to perform the following instructions: Specify the proper procedure to give a temporary name to a variable. A. proc print data=<libref>.<filename>; label = '<variable(s)>'; run; B. proc print data=<libref>.<filename>; label = <variable(s)>; run; C. proc print data=<libref>.<filename>; label '<variable(s)>'; run; D. proc print data=<libref>.<filename>; label <variable(s)>; run;

A. proc print data=<libref>.<filename>; label = '<variable(s)>'; run; NOTE: '<variable(s)>' specifies a label up to 256 characters

Select the proper syntax to perform the following instructions: Specify the proper function that replaces part of a character string. Where <cl>=character list. A. substrn(<string>, <position> , <length>)=<var>; B. <var>=substrn(<string>, <position> , <length>); C. <var>=scan(<string>,<count>,<cl>,'<modifier>'); D. <var>=catx('<delimiter>', <string>, <string>); E. <var>=find(<string>, <substring> , <start-position> , '<modifier(s)>');

A. substrn(<string>, <position> , <length>)=<var>; If <length> is omitted in the SUBSTR function in left-side SUBSTR then all remaining characters are replaced (from <position> to the end of the string) NOTE: The length of the result in either right or left side SUBSTR has the same length as the string. Hence, it is important to specify a LENGTH statement as needed prior to the use of the SUBSTR function. Example: NAME = 'CURTIS, BEN MIKE'; Substr(name,1,6)='LEE';

Select the proper syntax to perform the following instructions: Specify with special operators a way that selects observations in which the value of the variable falls within a range of values, inclusively. A. where <variable> between <value> and <value>; B. where <variable> ? '<value>'; C. where <variable> like '<value>_<value>%'; D. where <variable> =* '<value>'; E. where <variable> is <missing | null>;

A. where <variable> between <value> and <value>; Between <> and <> : selects observations in which the value of the variable falls within a range of values, inclusively. Example: where Salary between 50000 and 70000;

List Logical Operators

AND/& : if both expressions true compound true OR/| : if either expression true compound true NOT/^ : combine with other operators to reverse logic

Automatic Character to Numeric Vs. Numeric to Character

Automatic conversion is NOT DONE as the result of a where statement. Automatic conversion IS DONE as the result of an if statement provided the character variable has the form of a standard numeric variable. Ex: As long as no ($) or (,) etc character variables can be used as numeric. If other characters it will be read in as (.) Numeric data values are converted to character values in temporary variables when they are used in a character context. The format used for automatic conversation is the BEST12. format (which has a width of 12) and then the resulting character data value is RIGHT‐ALIGNED. This can create unwanted blanks in the resulting values.

Select the proper syntax to perform the following instructions: Specify the proper syntax of the rename= option to rename a variable. A. rename= (<var1>=<newvar>) B. (rename= (<var1>=<newvar>)) C. (rename= <var1>=<newvar>) D. rename (<var1>=<newvar>)

B. (rename= (<var1>=<newvar>)) You can use a RENAME= option in the set statement to change the name of a variable so that its values get read into a particular slot in the PDV Example: data <libref>.<filename> (rename = (oldvar=newvar)); set <librer>.<set1> (rename = (oldvar=newvar)) <libref>.<set2> (rename = (oldvar=newvar)); run;

Select the proper syntax to perform the following instructions: Specify the proper function that returns character values all in uppercase. A. <var>=propcase(<string>); B. <var=>upcase(<string>); C. <var>=lowcase(<string>); D. <var>=rand('normal');

B. <var=>upcase(<string>);

Select the proper syntax to perform the following instructions: Specify the proper function to specify a variable equaling the current quarter of the year listed as an integer. A. <var>=day(<SASdate>); B. <var>=qtr(<SASdate>); C. <var>=year(<SASdate>); D. <var>=wekday(<SASdate>); E. <var>=month(<SASdate>);

B. <var>=qtr(<SASdate>); QTR(<SASdate>) gives quarter in the year of the date (1 to 4)

Select the proper syntax to perform the following instructions: Specify the proper function that extracts a character string from variables, specifically extracting the first word from the left. A. <var>=scan(<string>,-1); B. <var>=scan(<string>,1); C. <var>=substr(<string>,-1) D. <var>=substr(<string>,1)

B. <var>=scan(<string>,1); If the count is positive, SCAN counts words from left to right in the character string. If the count is negative, SCAN counts words from right to left in the character string.

Select the proper syntax to perform the following instructions: Specify the proper function that extracts a part of a character starting at a specified position. Where <cl>=character list. A. substrn(<string>, <position> , <length>)=<value>; B. <var>=substrn(<string>, <position> , <length>); C. <var>=scan(<string>,<count>,<cl>,'<modifier>'); D. <var>=catx('<delimiter>', <string>, <string>); E. <var>=find(<string>, <substring> , <start-position> , '<modifier(s)>');

B. <var>=substrn(<string>, <position> , <length>); If <length> is omitted in the SUBSTR function in right-side SUBSTR then all remaining characters are extracted (from <length> to the end of the string) NOTE: The length of the result in either right or left side SUBSTR has the same length as the string. Hence, it is important to specify a LENGTH statement as needed prior to the use of the SUBSTR function. Example: NAME = 'CURTIS, BEN MIKE'; MidName=SCAN(name,3); Midinit = SUBSTR(MidName,1, 1); Midinit2=SUBSTR(SCAN(Name,3),1,1); [Ex:NESTED]

Select the proper syntax to perform the following instructions: Specify the proper function to specify a variable equaling today's date as a SAS date, just the date. A. <var>=time(); B. <var>=date(); C. <var>=datetime();

B. <var>=today(); today(); gives today's date value as a SAS date or date(); gives today's date value as a SAS date

Select the proper syntax to perform the following instructions: Specify the proper function that replaces or removes all occurrences of a string of characters from within a character string. A. <var>=index(<source>, <excerpt>); B. <var>=tranwrd(<source>, <target>, <replacement>); C. <var>=compress(<source> ,<characters>, '<modifier(s)>'); D. <var>=catx('<delimiter>', <string>, <string>);

B. <var>=tranwrd(<source>, <target>, <replacement>); <source> is the source string to be translated or updated. <target> is the string SAS is looking for in the source that is to be removed or replaced. <replacement> specifies the new string to replace the target. Use quotations if targeting a character string or replacing with a string of characters. To remove the <target> from <source>, simply use an empty quotation '' for <replacement>. The default length of the result from TRANWRD is 200. NOTE: TRANWRD function is case sensitive. Use UPCASE() , LOWCASE() function as needed.

Select the proper syntax to perform the following instructions: Specify a procedure that reads data from a data set that only includes observations where a variable has a specified value. A. Data <libref>.<filename>; Set <libref>.<filename> If <var>=<numeric/'char val'>; run; B. Data <libref>.<filename>; Set <libref>.<filename>; Where <var>=<numeric/'char val'>; run; C. Data <libref>.<filename>; Set <libref>.<filename>; Then <var>=<numeric/'char val'>; run; D. Data <libref>.<filename>; Set <libref>.<filename> Where <var>=<numeric/'char val'>; run;

B. Data <libref>.<filename>; Set <libref>.<filename>; Where <var>=<numeric/char val>; run; example: Data work.newfile; Set work.file; Where var1='Long' OR var1='Medium'; /* Or could use: Where var1='Long' and var2>30;*/ run; could also substitute if for where

Select the proper syntax to perform the following instructions: Specify the proper informat syntax to convert a date to an SAS date value. Assume the time is formatted ddmmmyy. A. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> mmddyy8.; run; B. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> date7.; run; C. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> yymmdd8.; run; D. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> time5.; run; E. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> datetime20.; run;

B. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> date7.; run; Date values that can be read by DATEw. ddmmmyy or ddmmmyyyy or dates with delimeters where dd: 1‐31 days, mmm: 1st three letters of the month's name, yy or yyyy is the year

Select the proper syntax to perform the following instructions: Specify a specific observation(s) to output. A. Data <libref>.<filename>; set <libref>.<filename>; when _n_=<value> then output; run; B. Data <libref>.<filename>; set <libref>.<filename>; if _n_=<value> then output; run; C. Data <libref>.<filename>; set <libref>.<filename>; if n=<value> then output; run; D. Data <libref>.<filename>; set <libref>.<filename>; if n=<value> then output; run;

B. Data <libref>.<filename>; set <libref>.<filename>; if _n_=<value> then output; run; example: Data work.newfile; set work.file; if _n_=5 then output; /*if _n_<5 then output;*/ run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to specify a permanent format catalog accessible in both proc print and the data step. A. Libname <libname> '<filepath>'; proc format LIB = <libname>; value <formatname> <value>='<label>'; run; Options fmtsearch=libname; B. Libname <libname> '<filepath>'; proc format LIB = <libname>; value <formatname> <value>='<label>'; run; Options fmtsearch=(libname); C. Libname <libname> '<filepath>'; proc format LIB = <libname>; value <formatname> <value>='<label>'; run; D. Libname <libname> '<filepath>'; proc format LIB = <libname>; value <formatname> <value>='<label>'; run; Options fmtsearch='libname';

B. Libname <libname> '<filepath>'; proc format LIB = <libname>; value <formatname> <value>='<label>'; run; Options fmtsearch=(libname); Formats can now be accessed with proc print or the data step. Example: Libname myfmt 'C:\Math610\fmtfolder'; Libname ofmts 'C:\Math610\formats'; proc format LIB = myfmt; value $sexfmt 'F' = 'Female'; Run; OPTIONS fmtsearch=(myfmt, ofmts); Proc print data=admitn; Format sex $sexfmt.; Run; If there were other formats accessible in the second library specified, the syntax would be used as above. Searching first in WORK.FORMATS catalog (if it exists), then in LIBRARY.FORMATS (if it exists), and then in myfmts, ofmts, and so on.

Select the proper syntax to perform the following instructions: Specify the proper syntax for the MDY function to create a SAS value detailing how many days since Jan/01/1960. A. MDY(20,15,15); B. MDY(10,15,15); C. MDY(10,35,15); D. MDY(10/15/15);

B. MDY(Mon, Day, Year) (only valid option as M has max=12 D max=31) NOTE: if you use a two-digit year, the default year‐cutoff is applied (1920) unless you previously submitted an options yearcutoff= with a year different than 1920. Ex: Assuming 1920 is the cutoff year(default), MDY(11,1,15); results in the number of days November 1, 2015 is from January 1, 1960. MDY (11,1,1915); results in the number of days November 1, 1915 is from January 1, 1960. MDY(11,1,23); results in number of days November 1, 1923 is from Janbuary 1, 1960. MDY(14,10, 2010) returns missing as 14 isn't a month 1‐12.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS destination with a table of contents and contents frame files created. A. ODS <destination>; FILE = '<filepath>'; CONTENTS = '<filepath>'; FRAME = '<filepath>'; <PROC procedures>; ODS <destinations> CLOSE; B. ODS <destination> BODY = '<filepath>' CONTENTS = '<filepath>' FRAME = '<filepath>'; <PROC procedures>; ODS <destinations> CLOSE; C. ODS <destination> BODY = '<filepath>' TABLEOFCONTENTS = '<filepath>' FRAME = '<filepath>'; <PROC procedures>; ODS <destinations> CLOSE; D. ODS <destination> FILE = '<filepath>' CONTENT = '<filepath>' FRAMES = '<filepath>'; <PROC procedures>; ODS <destinations> CLOSE;

B. ODS <destination> BODY = '<filepath>' CONTENTS = '<filepath>' FRAME = '<filepath>'; PROC procedures; ODS <destinations> CLOSE; NOTE: CONTENTS='<filepath>' is a file that contains a table of contents with links to procedure output. FRAME='<filepath>' is the name integrates HTML file and table of contents. If FRAME = is used, CONTENTS = must also be included. ODS HTML CLOSE; must be submitted in order to open the frame file and to see the table of contents and results. IMPORTANT: The results window does not display frame files. To view the frame file and display the table of contents open in an external browser.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS destination with a table of contents and contents frame files created and saved in a specified HTTP server with absolute links. A. ODS <destination> path = '<folderpath>' body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE; B. ODS <destination> path = '<folderpath>' (url = <serverpath>) body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE; C. ODS <destination> path = '<folderpath>' (url = none) body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE; D. ODS <destination> path = '<folderpath>' body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE;

B. ODS <destination> path = '<folderpath>' (url=<serverpath>) body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE; If no url= option specified results will be stored locally as temporary output.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open ODS destinations. A. ODS <open‐destination> OPEN; B. ODS <open‐destination>; C. ODS <open‐destination> CLOSE; D. ODS <open‐destination> CLEAR;

B. ODS <open‐destination>; SAS ODS allows for output to various destinations including: HTML, Listing, XML, RTF , PDF, and others By default, ODS HTML is open.

Select the proper syntax to perform the following instructions: Make a listing output double spaced option. A. Ods listing open; Proc print data = <libref>.<filename> double; Var <variable(s)>; Run; Ods listing close; B. Ods listing; Proc print data = <libref>.<filename> double; Var <variable(s)>; Run; Ods listing close; C. Obs listing open; Proc print data = <libref>.<filename> double; Var <variable(s)>; Run; Ods listing close; D. Obs listing; Proc print data = <libref>.<filename> double; Var <variable(s)>; Run; Ods listing close;

B. Ods listing; Proc print data = <libref>.<filename> double; Var <variable(s)>; Run; Ods listing close; NOTE: The DOUBLE option does not affect HTML output.

Select the proper syntax to perform the following instructions: Create a comment section. A. Open */ <Text> ; Close B. Open * <Text> ; Close

B. Open * <Text> ; Close example: * This is a comment;

Select the proper syntax to perform the following instructions: Select the global options for first observation to be read into a data set. A. Obs = <n> B. Options Firstobs = <n>; C. Obs = <n>; D. Firstobs = <n>;

B. Options Firstobs = <n>; example: Options Firstobs = 3 (observations will begin being read in at the third observation)

Select the proper syntax to perform the following instructions: Option that determines whether SAS writes source code to the SAS Log. A. Options Fmterr | Nofmterr; B. Options Source | Nosource; C. Options Error = <n>; D. Options obs = Max;

B. Options Source | Nosource; Example: Options Source; Options Nosource; (Default is source)

Select the proper syntax to perform the following instructions: Specify a procedure that reads data from an external data source and writes it to a SAS data set. A. Infile datafile='<filepath>' | table='<tablepath>' out=<libref>.<filename> DBMS=<identifier> Replace; Run; B. Proc Import datafile='<filepath>' | table='<tablepath>' out=<libref>.<filename> DBMS=<identifier> Replace; Run; C. Proc Import datafile='<filepath>' | table='<tablepath>' out=<libref>.<filename>; DBMS=<identifier>; Replace; Run; D. Infile datafile='<filepath>' | table='<tablepath>' out=<libref>.<filename>; DBMS=<identifier>; Replace; Run;

B. Proc Import datafile='<filepath>' | table='<tablepath>' out=<libref>.<filename> DBMS=<identifier> Replace; Example: Proc import datafile='C:\MATH610\RawData\salesdatad.txt' DBMS=DLM Out=work.mydata Replace; Run; (can use datafile=<filename> or table=<tablename> if a FILENAME='<filepath>'; global option is used to reference the file before the statement is made)

Select the proper syntax to perform the following instructions: Specify a procedure to print a SAS report with options to suppress the row numbers on the left side of the report. A. Proc print data=<libref>.<filename> split='<character>'; run; B. Proc print data=<libref>.<filename> noobs; run; C. Proc print data=<libref>.<filename>; Var <variable(s)>; run; D. Proc print data=<libref>.<filename>; ID <variable>; run;

B. Proc print data=<libref>.<filename> noobs; run;

Select the proper syntax to perform the following instructions: Specify a procedure to print a SAS report that specifies specific observations IN a specific variable(s). A. Proc print data=<libref>.<filename> split='<character>'; run; B. Proc print data=<libref>.<filename>; where <variables> in (<value>,<value>); run; C. Proc print data=<libref>.<filename>; Var <variable(s)>; run; D. Proc print data=<libref>.<filename>; ID <variable(s)>; run;

B. Proc print data=<libref>.<filename>; where <variables> in (<value>,<value>); run; /*can be where <variables> in (<value> , <value>);*/ NOTE: Character comparisons are casesensitive.

Select the proper syntax to perform the following instructions: Specify a procedure to print a SAS report that specifies specific observations. A. Proc print data=<libref>.<filename> split='<character>'; run; B. Proc print data=<libref>.<filename>; where <variables>=<value>; run; C. Proc print data=<libref>.<filename>; Var <variable(s)>; run; D. Proc print data=<libref>.<filename>; ID <variable(s)>; run;

B. Proc print data=<libref>.<filename>; where <variables>=<value>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a date constant. A. data <libref>.<filename>; <var>='ddmmmyyyyy'd; run; B. data <libref>.<filename>; <var>='ddmmmyy'd; run; C. data <libref>.<filename>; <var>=ddmmmyyyyd; run; D. data <libref>.<filename>; <var>='ddmmmyy't; run;

B. data <libref>.<filename>; <var>='ddmmmyy'd; run; Example: data dtime; tdate='01nov2010'd; ttime='19:12:11't; tdtm = '01NOV2010:19:12:11'dt; run; 'ddmmmyy'd or 'ddmmmyyyy'd dd is a one‐ or two‐digit value for the day. mmm is a three‐letter abbreviation for the month (JAN, FEB, and so on). yy or yyyy is a two‐ or four‐digit value for the year, respectively How yy is interepreted depends on yearcutoff= option (default is 1940‐2039) Tip: Be sure to enclose the date in quotation marks.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a nested do loop. A. data <libref>.<filename>; set <libref>.<filename>; do <var1>=<value> to <value>; <statement>; if <var2>=<value> to <value>; <statement>; end; end; run; B. data <libref>.<filename>; set <libref>.<filename>; do <var1>=<value> to <value>; <statement>; do <var2>=<value> to <value>; <statement>; end; end; run; C. data <libref>.<filename>; set <libref>.<filename>; do <var1>=<value> to <value>; <statement> do <var2>=<value> to <value>; <statement>; end; end; run; D. data <libref>.<filename>; set <libref>.<filename>; do <var1>=<value> to <value>; <statement>; do <var2>=<value> to <value>; <statement>; close; end; run;

B. data <libref>.<filename>; set <libref>.<filename>; do <var1>=<value> to <value>; <statement>; do <var2>=<value> to <value>; <statement>; end; end; run; data invest(drop=Quarter); do Year=1 to 5; Capital+5000; do Quarter=1 to 4; 4x Capital+(Capital*(.075/4)); end; end; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax for a do statement with explicit output. A. data <libref>.<filename>; set <libref>.<filename>; do; <statement1> <statement2>; output; run; B. data <libref>.<filename>; set <libref>.<filename>; do; <statement1>; <statement2>; output; end; run; C. data <libref>.<filename>; set <libref>.<filename>; output; <statement1>; <statement2>; end; run; D. data <libref>.<filename>; set <libref>.<filename>; do; <statement1>; <statement2>; put; end; run;

B. data <libref>.<filename>; set <libref>.<filename>; do; <statement1>; <statement2>; output; end; run; The OUTPUT statement tells SAS to write the current observation to a SAS data set immediately, not at the end of the DATA step. If no data set name is specified in the OUTPUT statement, the observation is written to the data set or data sets that are listed in the DATA statement. By default, every DATA step contains an implicit OUTPUT statement at the end of each iteration that tells SAS to write observations to the data set or data sets that are being created. Placing an explicit OUTPUT statement in a DATA step overrides the automatic output, and SAS adds an observation to a data set only when an explicit OUTPUT statement is executed. Once you use an OUTPUT statement to write an observation to any one data set, however, there is no implicit OUTPUT statement at the end of the DATA step. In this situation, a DATA step writes an observation to a data set only when an explicit OUTPUT executes. You can use the OUTPUT statement alone or as part of an IF-THEN or SELECT statement or in DO-loop processing.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a length of 3 for a character variable. A. data <libref>.<filename>; set <libref>.<filename>; length <var2> 3; if <var1>=20 then <var2>='LONG'; run; B. data <libref>.<filename>; set <libref>.<filename>; length <var2> $ 3; if <var1>=20 then <var2>='LONG'; run; C. data <libref>.<filename>; set <libref>.<filename>; length <var2> $ 4; if <var1>=20 then <var2>='LONG'; run; D. data <libref>.<filename>; set <libref>.<filename>; if <var1>=20 then <var2>='LONG'; length <var2> $ 3; run;

B. data <libref>.<filename>; set <libref>.<filename>; length <var2> $ 3; if <var1>=20 then <var2>='LONG'; run; Length should be stated before a variable is encountered or will get: "Length of character variable <var2> has already been set. Use the LENGTH statement as the very first statement in the DATA STEP to declare the length of a character variable."

Select the proper syntax to perform the following instructions: Specify the proper procedure to perform one to one reading of data sets. A. data <libref>.<filename>; merge <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; B. data <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; run; C. data <libref>.<filename>; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; run; D. data SASdataset; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; E. proc append base = <libref>.<filename> data = <libref>.<filename>; run;

B. data <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; run; The new data set contains all variables from all input data sets. If the data sets contain variables that have the same names, the values that are read in from the last data set to overwrite the values that were read in from earlier data sets. The # of observations in the new data set is the # of observations in the SMALLEST original input data set. Observations are combined based on their relative position in each data set. That is, the first observation in one data set is joined with the first observation in the other, the second to second, and so on. The process stops after it reads the last observation from the smallest data set.

Select the proper syntax to perform the following instructions: Specify a libname statement options for reading EXCEL files that determines whether to import data with both character and numeric values and convert all data to character. A. libname <libref> '<filepath>' dbmax_text=n; B. libname <libref> '<filepath>' mixed=yes|no; C. libname <libref> '<filepath>' scantext=yes|no; D. libname <libref> '<filepath>' getnames = yes|no; E. libname <libref> '<filepath>' scantime=yes|no; F. libname <libref> '<filepath>' usedate=yes|no;

B. libname <libref> '<filepath>' mixed=yes|no; NOTE: Default = no, which will read character as character and numeric as numeric. A wrong data type will be read as missing.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination with actions to exclude certain with a certain file path in the output. A. ods excel exclude ALL; B. ods excel exclude where=(_path_ ='filepath'); C. ods excel exclude NONE; D. ods excel exclude where=(_path_ ? "<value>" );

B. ods excel exclude where=(_path_ ='filepath'); Example: ods excel exclude where=(_path_ ? "Diastolic" ); excludes files that contain <Diastolic> ods excel exclude ALL; temporarily suspends output ods excel exclude NONE; resets to default output, all included. NOTE: A destination must be open for this action to take effect.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination with the option that customizes the worksheet label. A. ods excel file= '<filepath>' (embedded_titles='yes|no'); B. ods excel file= '<filepath>' (sheet_label='<value>'); C. ods excel (suppress_bylines='yes|no'); D. ods excel file= '<filepath>' (sheet_interval="bygroup"); E. ods excel file= '<filepath>' (sheet_name='<value>');

B. ods excel file= '<filepath>' (sheet_label='<value>'); Worksheet name in output will be displayed as <value> - <Workbook-Title>

Select the proper syntax to perform the following instructions: Select the global option for first page number to read into a data set. A. pagenumber = <n>; B. options pageno = <n>; C. pageno = <n>; D. options pagenumber= <n>;

B. options pageno = <n> example: options pageno = 3

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a user-defined character format in a temporary catalog. A. proc format <options>; $<format name> value '<range>'='<label>'; run; B. proc format <options>; value $<format name> '<range>'='<label>'; run; C. proc format <options>; value <format name> '<range>'='<label>'; run; D. proc format <options>; value $<format name> <range>='<label>'; run;

B. proc format <options>; value $<format name> '<range>'='<label>'; run; Example: proc format; value $gradefm 'A'='Good' 'B'-'D'='Fair' 'F'='Poor' 'I','U'='See Instructor' other='Miscoded'; run; Keywords: OTHER, LOW, HIGH The key words do not include missing data for numeric formats but do include missing data for character formats.

Select the proper syntax to perform the following instructions: Specify the proper syntax to specify a range so that the variable is formatted to '<label>' if it is equal to <value1>. A. proc format; value $<formatname> '<value1>'-'<value2>'='<label>'; run; B. proc format; value $<formatname> '<value1>'='<label>'; run; C. proc format; value $<formatname> '<value1>','<value2>'='<label>'; run; D. proc format; value $<formatname> other='<label>'; run;

B. proc format; value $<formatname> '<value1>'='<label>'; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a frequency table with options that specify variable levels requested in the tables statement in frequency order (greatest to least). A. proc freq data=<libref>.<filename> levels freq=order; tables <var1> <var2>; run; B. proc freq data=<libref>.<filename> nlevels order=freq; tables <var1> <var2>; run; C. proc freq data=<libref>.<filename> levels; tables <var1> <var2>; run; D. proc freq data=<libref>.<filename> nlevels; tables <var1> <var2>; run;

B. proc freq data=<libref>.<filename> nlevels order=freq; tables <var1> <var2>; run; NOTE: If TABLES statement is omitted, by default it will display for all variables in that dataset.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a two-way, or cross-tabular, frequency report for <var1> <*> <var3> <var2> <*> <var3> <var1> <*> <var4> and <var2> <*> <var4>. A. proc freq data=<libref>.<filename>; tables <var1><*>(<var2> <var3>); run; B. proc freq data=<libref>.<filename>; tables (<var1> <var2>)<*>(<var3 <var4>); run; C. proc freq data=<libref>.<filename>; tables <var1><*><var2>; run; D. proc freq data=<libref>.<filename>; tables <var1>--<var3>; run; E. proc freq data=<libref>.<filename>; tables (<var1>--<var3>)<*><var4>; run; F. proc freq data=<libref>.<filename>; tables <var1><*><var2><*><var3>; run;

B. proc freq data=<libref>.<filename>; tables (<var1> <var2>)<*>(<var3 <var4>); run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency table that suppresses cell percent. A. proc freq data=<libref>.<filename>; tables <var(s)>/nofreq; run; B. proc freq data=<libref>.<filename>; tables <var(s)>/nopercent; run; C. proc freq data=<libref>.<filename>; tables <var(s)>/norow; run; D. proc freq data=<libref>.<filename>; tables <var(s)>/nocol; run; E. proc freq data=<libref>.<filename>; tables <var(s)>/nocum; run; F. proc freq data=<libref>.<filename>; tables <var(s)>/list; run; G. proc freq data=<libref>.<filename> crosslist; tables <var(s)>/crosslist; run;

B. proc freq data=<libref>.<filename>; tables <var(s)>/nopercent; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency table. A. proc means data=<libref>.<filename>; run; tables <var(s)>; B. proc freq data=<libref>.<filename>; tables <var(s)>; run; C. proc freq data=<libref>.<filename>; tables <var1>*<var2>; run; D. proc freq data=<libref>.<filename>; class <var(s)>; run;

B. proc freq data=<libref>.<filename>; tables <var(s)>; run; This will produce a frequency report for each individual variable listed in tables.

Select the proper syntax to perform the following instructions: Specify the proper syntax to import a file indicating at which row SAS begins to read the data A. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; delimiter='<value>'; run; B. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; datarow=<value>; run; C. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; guessingrows=<value>; run; D. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; getnames=<yes|no>; run;

B. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; datarow=<value>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to produce a statistics report only showing the number of non-missing observations for the variables of the data set. A. proc means data=<libref>.<filename> median; run; B. proc means data=<libref>.<filename> n; run; C. proc means data=<libref>.<filename> mean; run; D. proc means data=<libref>.<filename> max; run; E. proc means data=<libref>.<filename> min; run;

B. proc means data=<libref>.<filename> n; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to display simple descriptive statistics that groups sorted observations of the SAS data set for analysis. A. proc means data=<libref>.<filename>; var <var(s)>; run; B. proc means data=<libref>.<filename>; by <var(s)>; run; C. proc means data=<libref>.<filename>; class <var(s)>; run;

B. proc means data=<libref>.<filename>; by <var(s)>; run; When using BY, data MUST be sorted based on the variables in the BY statement first using PROC SORT. The result using the BY statement is displayed as separate tables for the category of the variables in the BY statement. If there are two or more variables in the BY statement, the order determines the order of the displayed tables in the report.

Select the proper syntax to perform the following instructions: Specify a procedure to generate a column total. A. proc print data = <libref>.<filename>; var <variables>; Total <variable(s)>; run; B. proc print data = <libref>.<filename>; var <variables>; Sum <variable(s)>; run; C. proc print data = <libref>.<filename>; var <variables>; Total <variable(s)>; By <variables> run; D. proc print data = <libref>.<filename>; var <variables>; Sum <variable(s)>; By <variables>; run;

B. proc print data = <libref>.<filename>; var <variables>; Sum <variable(s)>; run; (The SUM statement also produces subtotals if you print the data in groups.)

Select the proper syntax to perform the following instructions: Specify the proper syntax to output a summary to a SAS data set with a report. A. proc freq data=<libref>.<filename>; run; B. proc summary data =<libref>.<filename> PRINT; C. proc contents data=<libref>.<filename>; run; D. proc means data=<libref>.<filename>; run;

B. proc summary data =<libref>.<filename> PRINT; PROC SUMMARY does not produce a report by default. In order to produce a report, you need to add PRINT as the option in the Proc Summary statement. Can do aswell to print: proc summary data =<libref>.<filename>; output out=<libref>.<filename>; run; proc print data=<libref>.<filename>; run; NOTE: OR you can use the option: NOPRINT in PROC MEANS.

Select the proper syntax to perform the following instructions: Specify the proper syntax to transpose a data set. A. proc transpose <libref>.<filename>; set <libref>.<filename> prefix=<prefixcharacters>; by descending <vari> notsorted; id <var(s)>; var <var(s)>; Run; B. proc transpose data=<libref>.<filename> out=<libref>.<filename> prefix=<prefixcharacters>; by descending <vari> notsorted; id <var(s)>; var <var(s)>; Run; C. proc transpose data=<libref>.<filename>; output=<libref>.<filename> prefix=<prefixcharacters>; by descending <vari> notsorted; id <var(s)>; var <var(s)>; Run; D. proc transpose infile=<libref>.<filename> out=<libref>.<filename> prefix=<prefixcharacters>; by descending <vari> notsorted; id <var(s)>; var <var(s)>; Run;

B. proc transpose data=<libref>.<filename> out=<libref>.<filename> prefix=<prefixcharacters>; by descending <vari> notsorted; id <var(s)>; var <var(s)>; Run; • prefix specifies a prefix to use in constructing names for transposed variables in the output data set. For example, if PREFIX=VAR, then the names of the variables are VAR1, VAR2, ..., VARn. The default variable name is COLn. Note: When you use PREFIX= with an ID statement, the variable name begins with the prefix value followed by the ID value.

Select the proper syntax to perform the following instructions: Specify the proper function that returns the value rounded to the unit specified. A. floor(<argument>); B. round(<argument>,<round-off-unit>); C. ceil(<argument>); D. int(<argument>);

B. round(<argument>,<round-off-unit>);

Select the proper syntax to perform the following instructions: Specify the proper syntax to compute the sum of variables 1-5, excluding any variables that may be between them. A. sum (<var1>-<var5>) B. sum (of <var1>-<var5>) C. sum (<var1>--<var5>) D. sum(<var1> <var2> <var3> <var4> <var5>)

B. sum (of <var1>-<var5>) sum(<var1> <var2> <var3> <var4> <var5>) must be sum(<var1>,<var2>,<var3>,<var4>,<var5>) NOTE: Missing values are ignored in the computation. sum (<var1>-<var5>) calculates the sum of <var1> minus <var5> NOTE: Missing values are not ignored in this computation.

Select the proper syntax to perform the following instructions: Specify with special operators a way to select observations that include the specified substring. A. where <variable> between <value> and <value>; B. where <variable> ? '<value>'; C. where <variable> like '<value>_<value>%'; D. where <variable> =* '<value>'; E. where <variable> is <missing | null>;

B. where <variable> ? '<value>'; Contains/? : selects observations that include the specified substring. Example: where LastName ? 'LAM';

Select the proper syntax to perform the following instructions: Specify the proper function that returns a character string with specified characters removed from the original string. A. <var>=index(<source>, <excerpt>); B. <var>=tranwrd(<source>, <target>, <replacement>); C. <var>=compress(<source> ,<characters>, '<modifier(s)>'); D. <var>=catx('<delimiter>', <string>, <string>);

C. <var>=compress(<source> ,<characters>, '<modifier(s)>'); Null arguments are treated as a string with a length of zero. <characters> specifies a character constant, variable, or expression. NOTE: If specifying a string of actual characters for <characters> use quotations.

Select the proper syntax to perform the following instructions: Specify the proper function to specify a variable equaling today's date and time as a SAS datetime. A. <var>=time(); B. <var>=date(); C. <var>=datetime();

C. <var>=datetime(); datetime(); gives current date time as a SAS datetime

Select the proper syntax to perform the following instructions: Specify the proper function that applies multiples of a given interval to a date, time, or datetime value and returns the resulting SAS value. A. <var>=intck('<interval>' , '<ddmmmyy>'d , 'ddmmmyy'd); B. <var>=intck('<interval>' , '<ddmmmyy>' , 'ddmmmyy'); C. <var>=intnx('<interval>', 'ddmmmyy'd, <increment>); D. <var>=intnx('<interval>', 'ddmmmyy', <increment>);

C. <var>=intnx('<interval>', 'ddmmmyy'd, <increment>); The type of INTERVAL (date, time, or datetime) must match the type of values used in (<interval>,<FROM>, <increment>) Example: <var>=intnx('minute', '01FEB2010:00:00:00'dt, 1); or <var>=intnx('month', '05FEB2010'd, 1, 'm'); NOTE: Alignment- forces the alignment of the returned date to be the beginning <'b'>, middle <'m'>, end <'e'>, or same day <'s'> of the time interval. The default is the beginning.

Select the proper syntax to perform the following instructions: Specify the proper function that returns character values all in lowercase. A. <var>=propcase(<string>); B. <var=>upcase(<string>); C. <var>=lowcase(<string>); D. <var>=allcaps(<string>);

C. <var>=lowcase(<string>);

Select the proper syntax to perform the following instructions: Specify the proper function that extracts a character string from variables. Where <cl>=character list. A. substrn(<string>, <position> , <length>)=<var>; B. <var>=substrn(<string>, <position> , <length>); C. <var>=scan(<string>,<count>,<cl>,'<modifier>'); D. <var>=catx('<delimiter>', <string>, <string>); E. <var>=find(<string>, <substring> , <start-position> , '<modifier(s)>');

C. <var>=scan(<string>,<count>,<cl>,'<modifier>'); <string> specifies a character constant, variable, or expression. <count> is a nonzero numeric constant, variable, or expression that has an integer value. The integer value specifies the number of the word in the character string that you want SCAN to select. For example, a value of 1 indicates the first word, a value of 2 indicates the second word, and so on. Example: Name = 'CURTIS, BEN MIKE'; Fname2=scan(Name,2,', '); gives BEN Fname3=SCAN(name,3); gives the result MIKE Fname4=SCAN(Name,2,','); gives BEN MIKE

Select the proper syntax to perform the following instructions: Specify the proper function that trims trailing blanks. A. <var>=left(<string>); B. <var>=right(<string>); C. <var>=trim(<string>); D. <var>=compbl(<string>);

C. <var>=trim(<string>); Trailing blanks are often a result of applying SAS character functions and can cause problems when concatenating strings. NOTE: length of a TRIMMED Variable is the same as the untrimmed variable. Length is NOT trimmed. This is true for the left function as well.

Select the proper syntax to perform the following instructions: Specify the proper function to specify a variable equaling the current year listed as an integer. A. <var>=day(<SASdate>); B. <var>=qtr(<SASdate>); C. <var>=year(<SASdate>); D. <var>=wekday(<SASdate>); E. <var>=month(<SASdate>);

C. <var>=year(<SASdate>); YEAR(<SASdate>) gives the year of the date (4 digit year) The <SASdate> above can be a variable, a numeric constant or a date constant.

Where should the proc format statement go? A. Before the data step but after the proc print step it is referenced in B. After the data step but before the proc print step it is referenced in C. Before the data step and proc print step its referenced in D. After the data step and proc print step it is referenced in

C. Before the data step and proc print step its referenced in

Select the proper syntax to perform the following instructions: Specify a procedure that drops or keeps a variable from the source before being read into the data step, not available for processing. A. Data <libref>.<filename>; Set <libref>.<filename>(drop/keep=<var>); drop/keep <var>; run; B. Data <libref>.<filename>; drop/keep <var>; Set <libref>.<filename>(drop/keep=<var>); run; C. Data <libref>.<filename>; Set <libref>.<filename>(drop/keep=<var>); run; D. Data <libref>.<filename>(drop/keep=<var>); Set <libref>.<filename>; run;

C. Data <libref>.<filename>; Set <libref>.<filename>(drop/keep=<var>); run; example: Data work.newfile; Set work.file(drop=var1); if var1='yes'; run; (if statement error as var1 is not available for processing. Will produce no observations as var1^='yes';)

Select the proper syntax to perform the following instructions: Specify the proper informat syntax to convert a datetime to an SAS date value. Assume the time is formatted yy/mm/dd. A. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> mmddyy8.; run; B. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> date7.; run; C. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> yymmdd8.; run; D. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> time5.; run; E. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> datetime20.; run;

C. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> yymmdd8.; run;

Select the proper syntax to perform the following instructions: Specify the proper procedure to produce a nested function; A. Data <libref>.<filename>; set <libref>.<filename>; <var>=<function>(); run; B. Data <libref>.<filename>; set <libref>.<filename>; <var>=<function>(<function>); run; C. Data <libref>.<filename>; set <libref>.<filename>; <var>=<function>(<function>()); run; D. Data <libref>.<filename>; set <libref>.<filename>; <var>=<function><function>(); run;

C. Data <libref>.<filename>; set <libref>.<filename>; <var>=<function>(<function>()); run; Example: Data Nest_Ex; name = 'Curtis, Ben, mike'; Midname=trim(UPCASE(substr(scan(name,3),1,1)))||'.'; Run;

Select the proper syntax to perform the following instructions: Specify the proper procedure to create a variable that shows the accumulated sum of variable 1. A. Data <libref>.<filename>; set <libref>.<filename>; retain sumvar1 5; sumvar1+<var1>; put id= <var1>= sumcvar1= ; Run; B. Data <libref>.<filename>; set <libref>.<filename>; sumvar1+<var1>=1; put id= <var1>= sumcvar1= ; Run; C. Data <libref>.<filename>; set <libref>.<filename>; sumvar1+<var1>; put id= <var1>= sumcvar1= ; Run; D. Data <libref>.<filename>; set <libref>.<filename>; sumvar1=<var1>; put id= <var1>= sumcvar1= ; Run;

C. Data <libref>.<filename>; set <libref>.<filename>; sumvar1+<var1>; put id= <var1>= sumcvar1= ; Run; Example: Data SalesSums; set QuarterSales; Sumq1+q1; Sumq2+q2; Put id= q1= q2= sumq1= sumq2= ; Run; At the beginning of the data step, the value of this numeric variable is not set to missing rather it starts with a value of 0 and it retains its new value in the Program Data Vector for use in processing the next observation. If the expression produces a missing value then in the sum statement it is taken as zero. NOTE: In an assignment statement if an expression produces missing the value is assigned a missing value

Select the proper syntax to perform the following instructions: Specify the proper use of IF Then Else If statement. A. IF score >= 90 THEN grade = 'A'; IF score >= 80 THEN grade = 'B' ; ELSE grade = 'F'; B. IF score >= 90 ELSE grade = 'A'; ELSE IF score >= 80 ELSE grade = 'B' ; ELSE grade = 'F'; C. IF score >= 90 THEN grade = 'A'; ELSE IF score >= 80 THEN grade = 'B' ; ELSE grade = 'F'; D. IF score >= 90 ELSE grade = 'A'; THEN IF score >= 80 IF grade = 'B' ; ELSE grade = 'F';

C. IF score >= 90 THEN grade = 'A'; ELSE IF score >= 80 THEN grade = 'B' ; ELSE grade = 'F'; Produces the same result as: IF score >= 90 THEN grade = 'A'; IF 80 <= score < 90 THEN grade = 'B'; IF score < 80 THEN grade = 'F'; but requires less computing. When IF‐THEN‐ELSE first encounters a true condition in IF or ELSE IF it executes the statement and exits IF‐THEN ELSE. If it does not find a true condition in IF or the ELSE IF statements it executes the statement in ELSE.

Select the proper syntax to perform the following instructions: Create a libref (library reference). A. Libref <libref> <filepath>; B. Libname <liref> '<filepath>' C. Libname <libref> '<filepath>'; D. Libref <name> '<filepath>';

C. Libname <libref> '<Filepath>'; example: Libname mylib 'C:\math610\programfiles\';

Select the proper syntax to perform the following instructions: Specify a procedure to rename the Variable Names from Excel Sheet without getnames. A. Libname <libref> '<filepath>.xls' getnames=no mixed=Yes; Data <libref>.<filename> (Label = (Var1=<var1> Var2=<var2> Var3=<var3> Var4=<var4>)); Set <libref>.'<filename>$'n ; run; B. Libname <libref> '<filepath>.xls' getnames=no mixed=Yes; Data <libref>.<filename> (Rename = F1=<var1> F2=<var2> F3=<var3> F4=<var4>); Set <libref>.'<filename>$'n ; run; C. Libname <libref> '<filepath>.xls' getnames=no mixed=Yes; Data <libref>.<filename> (Rename = (F1=<var1> F2=<var2> F3=<var3> F4=<var4>)); Set <libref>.'<filename>$'n ; run; D. Libname <libref> '<filepath>.xls' getnames=no mixed=Yes; Data <libref>.<filename> (Label = (F1=<var1> F2=<var2> F3=<var3> F4=<var4>)); Set <libref>.'<filename>$'n ; run;

C. Libname <libref> '<filepath>.xls' getnames=no mixed=Yes; Data <libref>.<filename> (Rename = (F1=<var1> F2=<var2> F3=<var3> F4=<var4>)); Set <libref>.'<filename>$'n ; run; example: Libname Ex_adm 'C:\Math610\admit.xls' getnames=no mixed=Yes; Data Ex_admit (RENAME = (F1=ID F2=NAME F3=Sex F4=Age)); Set ex_adm.'admit$'n ; run; (If getnames = no, the default var names are F1, F2, F3,..)

Select the proper syntax to perform the following instructions: Specify a procedure that reads data from an external data source XLSX file with a literal SAS name and writes it to a SAS data set. A. Libname <libref> '<filepath>.xlsx'; Data <libref>.<filename>; Set <libref>.<filename>$n ; Run; B. Libname <libref> '<filepath>.xlsx'; Data <libref>.<filename>; Set <libref>.'<filename>'n ; Run; C. Libname <libref> '<filepath>.xlsx'; Data <libref>.<filename>; Set <libref>.'<filename>$'n ; Run; D. Libname <libref> '<filepath>.xlsx'; Data <libref>.<filename>; Set <libref>.<filename> ; Run;

C. Libname <libref> '<filepath>.xlsx'; Data <libref>.<filename>; Set <libref>.'<filename>$'n ; Run; Example: Libname test 'C:\exceldata\Exercise.xlsx'; Data exer_sasdata; Set test.'exercise$'n ; Run; (Can use 'n' or 'N' example: 'Exercise$'n or 'exercise$'N)

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS destination with a table of contents and contents frame files created and saved in a specified folder with relative links. A. ODS <destination> path = '<folderpath>' body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE; B. ODS <destination> path = '<folderpath>' (url = <serverpath>) body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE; C. ODS <destination> path = '<folderpath>' (url = none) body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE; D. ODS <destination> path = '<folderpath>' body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE;

C. ODS <destination> path = '<folderpath>' (url= none) body = '<filename_b>' contents = '<filename_c>' frame = '<filename_f>'; ODS <destination> CLOSE; This saves the body, contents, and frame files in the location specified by Path= without having to type the path for each file. The links will be relative. Note: without (URL=None) the links will be absolute.

Select the proper syntax to perform the following instructions: Specify the proper syntax to close ODS destinations. A. ODS <open‐destination> OPEN; B. ODS <open‐destination>; C. ODS <open‐destination> CLOSE; D. ODS <open‐destination> CLEAR;

C. ODS <open‐destination> CLOSE; SAS ODS allows for output to various destinations including: HTML, Listing, XML, RTF , PDF, and others By default, ODS HTML is open.

Select the proper syntax to perform the following instructions: Specify the maximum # of observations for which the data error message are printed. A. Options Fmterr | Nofmterr; B. Options Source | Nosource; C. Options Error = <n>; D. Options obs = Max;

C. Options Error = <n>; example: Options Error=4; (will not print data errors past 4th observation)

Select the proper syntax to perform the following instructions: Select the global option for last observation to be read into a data set. A. Obs = <n>; B. Options Firstobs = <n>; C. Options Obs = <n>; D. Firstobs = <n>;

C. Options Obs = <n>; example: Obs = 5; (obsevations will stop being read at the fifth observation)

Select the proper syntax to perform the following instructions: Specify a procedure to print a SAS report with selected variables. A. Poc print data=<libref>.<filename>; Class <variable(s)>; run; B. Poc print data=<libref>.<filename>; If <variable(s)>; run; C. Poc print data=<libref>.<filename>; Var <variable(s)>; run; D. Poc print data=<libref>.<filename>; Where <variable(s)>; run;

C. Poc print data=<libref>.<filename>; Var <variable(s)>; run;

Select the proper syntax to perform the following instructions: Specify a procedure to sort a specified data file by a descending variable. A. Proc sort data=<libref>.<filename>; out=<libref>.<filename>; By descending <variable(s)>; run; B. Proc sort data=<libref>.<filename> out=<libref>.<filename>; By ascending <variable(s)>; run; C. Proc sort data=<libref>.<filename> out=<libref>.<filename>; By descending <variable(s)>; run; D. Proc sort data=<libref>.<filename>; out=<libref>.<filename>; By ascending <variable(s)>; run;

C. Proc sort data=<libref>.<filename> out=<libref>.<filename>; By descending <variable(s)>; run; Example: proc sort data=mylib.empdata out=empdata_s; by JobCode descending Salary; run; NOTE: The above SORT statement: SORT by JobCode in ascending order then SORT by salary in DESCENDING order because DESCENDING only applies to the variable immediately following it. (1. does not generate printed output. 2. treats missing values as the smallest possible value. 3. ascending is the default. 4. If you do not use out = option, the sorted data set will replace the original data set permanently.)

Select the proper syntax to perform the following instructions: Define MULTIPLE titles or footnotes. A. Title='<titletext>'; Footnote='<footnotetext>'; B. Title<n>=<titletext>; Footnote<n>=<footnotetext>; C. Title<n>='<titletext>'; Footnote<n>='<footnotetext>'; D. Title=<titletext>; Footnote=<footnotetext>;

C. Title<n>='<titletext>'; Footnote<n>='<footnotetext>'; Example: Title='Title one text' Title3='title three text'; Footnote4='footnote 4 text'; (Creates a title on line 1 and 3 with a line in between. Footnote 4 is created 4 lines from the bottom. Titles/Footnotes can be n=1-10)

Select the proper syntax to perform the following instructions: Specify the proper function that returns the value 'rounded‐up' to the smallest integer larger than the argument. A. floor(<argument>); B. round(<argument>,<round-off-unit>); C. ceil(<argument>); D. int(<argument>);

C. ceil(<argument>);

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a time constant. A. data <libref>.<filename>; <var>='hh:mm:ss'd; run; B. data <libref>.<filename>; <var>=hh:mm:sst; run; C. data <libref>.<filename>; <var>='hh:mm:ss't; run; D. data <libref>.<filename>; <var>='dd:mm:yy't; run;

C. data <libref>.<filename>; <var>='hh:mm:ss't; run; Example: data dtime; ttime='19:12:11't; run; 'hh:mm't or 'hh:mm:ss't hh is a one‐ or two‐digit value for hours since midnight. mm is a one‐ or two‐digit value for seconds. ss is a one‐ or two‐digit value for seconds. Tip: Be sure to enclose the time in quotation marks.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create an iterative do loop by increments specified as <value1> and <value2>. A. data <libref>.<filename>; set <libref>.<filename>; do <var>=<value1> through <value2>; <statement1>; <statement2>; end; run; B. data <libref>.<filename>; set <libref>.<filename>; do <var>=<value1> - <value2>; <statement1>; <statement2>; end; run; C. data <libref>.<filename>; set <libref>.<filename>; do <var>=<value1> to <value2>; <statement1>; <statement2>; end; run; D. data <libref>.<filename>; set <libref>.<filename>; do <var>=<value1> to <value2>; <statement1> <statement2>; run;

C. data <libref>.<filename>; set <libref>.<filename>; do <var>=<value1> to <value2>; <statement1>; <statement2>; end; run; Example: do year=1 to 5; Capital+5000; Capital+(Capital*.075); end; run;

Select the proper syntax to perform the following instructions: A put statement with conditional processing to flag errors or data out of range. A. data <libref>.<filename>; set <libref>.<filename>; if <var> > 0 then <var>=<value>; else do '<error text>' <var>= _n_ = ; run; B. data <libref>.<filename>; set <libref>.<filename>; when <var> > 0 then <var>=<value>; else put '<error text>' <var>= _n_ = ; run; C. data <libref>.<filename>; set <libref>.<filename>; if <var> > 0 then <var>=<value>; else put '<error text>' <var>= _n_ = ; run; D. data <libref>.<filename>; set <libref>.<filename>; if <var> > 0 then <var>=<value>; else putlog '<error text>' <var>= _n_ = ; run;

C. data <libref>.<filename>; set <libref>.<filename>; if <var> > 0 then <var>=<value>; else put '<error text>' <var>= _n_ = ; run; example: data work.newcalc; set cert.loan. if rate>0 then Interest=amount*(rate/12); else put 'Data Error: ' rate= _n_ = ; run;

Select the proper syntax to perform the following instructions: Specify the proper procedure to perform concatenation of two data sets. A. data <libref>.<filename>; merge <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; B. data <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; run; C. data <libref>.<filename>; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; run; D. data SASdataset; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; E. proc append base = <libref>.<filename> data = <libref>.<filename>; run;

C. data <libref>.<filename>; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; run; The data sets are read in the sequence that they are listed in the SET statement. All of the observations are read from the first data set, then all observations are read from the second data set, and so on. The new data set contains all variables and observations from the input data sets. If data sets contain variables with the same name: - these variables MUST have the same data type (numeric or character), otherwise, SAS will stop processing the data step and generate an error message. - SAS takes the length attribute of the variable in the FIRST data set listed in the set statement. The same is true for label, format, informat attributes.

Select the proper syntax to perform the following instructions: Specify a libname statement options for reading EXCEL files that determines whether to read the entire data column and use the length of the longest string as the SAS column width. A. libname <libref> '<filepath>' dbmax_text=n; B. libname <libref> '<filepath>' mixed=yes|no; C. libname <libref> '<filepath>' scantext=yes|no; D. libname <libref> '<filepath>' getnames = yes|no; E. libname <libref> '<filepath>' scantime=yes|no; F. libname <libref> '<filepath>' usedate=yes|no;

C. libname <libref> '<filepath>' scantext=yes|no; NOTE: Default = yes. If it is no, then the column width is 255.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination with the option that suppresses the BY lines for each BY group. A. ods excel file= '<filepath>' (embedded_titles='yes|no'); B. ods excel file= '<filepath>' (sheet_label='<value>'); C. ods excel (suppress_bylines='yes|no'); D. ods excel file= '<filepath>' (sheet_interval="bygroup"); E. ods excel file= '<filepath>' (sheet_name='<value>');

C. ods excel (suppress_bylines='yes|no');

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination with actions to writes the current selection list or exclusion list for the destination to the SAS log. A. ods excel listing; B. ods listing; C. ods excel show; D. ods excel show all;

C. ods excel show; Note: If the selection or exclusion list is the default list (SELECT ALL), then SHOW also writes the entire selection or exclusion list. The destination must be open for this action to take effect.

Select the proper syntax to perform the following instructions: Specify a procedure that reads data from an external data source CSV file and writes it to a SAS data set. A. options validvarname=v7; Proc Import infile='<filepath>' dbms=csv out=<libref>.<filename> replace; getnames=<yes/no>; run; B. options validvarname=v7; Proc Import infile='<filepath>'; dbms=csv; out=<libref>.<filename>; replace; getnames=<yes/no>; run; C. options validvarname=v7; Proc Import datafile='<filepath>' dbms=csv out=<libref>.<filename> replace; getnames=<yes/no>; run; D. options validvarname=v7; Proc Import datafile='<filepath>'; dbms=csv; out=<libref>.<filename>; replace; getnames=<yes/no>; run;

C. options validvarname=v7; Proc Import datafile='<filepath>' dbms=csv out=<libref>.<filename> replace; getnames=<yes/no>; run; example: options validvarname=v7; Proc Import datafile='C:\Math610\file.csv' dbms=csv out=work.newfile replace; getnames=no; run; (getnames=no; will not use the first row as var names.)

Select the proper syntax to perform the following instructions: Specify the proper syntax to assign a new year cutoff. A. obs yearcutoff=<year>; B. options year=<year>; C. options yearcutoff=<year>; D. yearcutoff=<year>;

C. options yearcutoff=<year>;

Select the proper syntax to perform the following instructions: Specify the proper procedure to append when variables do not match. A. proc append = <libref>.<filename> data = <libref>.<filename> force; run; B. proc append base = <libref>.<filename> data = <libref>.<filename> <libref>.<filename> force; run; C. proc append base = <libref>.<filename> data = <libref>.<filename> force; run; D. proc append base = <libref>.<filename> data = <libref>.<filename> merge; run;

C. proc append base = <libref>.<filename> data = <libref>.<filename> force; run; Without the Force option the variables in the base= and the data= data sets must "match‐up". If there is not a match and there is no Force option the append procedure will generate errors and stop processing and the base= data set will not be altered. All of and only the variables that are in the base= data set are in the result of Proc Append.

Select the proper syntax to perform the following instructions: Specify the proper syntax to list the contents of one or more SAS data sets and print the directory of the SAS library. A. proc freq data=<libref>.<filename>; run; B. proc summary data =<libref>.<filename> PRINT; C. proc contents data=<libref>.<filename>; run; D. proc means data=<libref>.<filename>; run;

C. proc contents data=<libref>.<filename>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to specify a range so that the variable is formatted to '<label>' if it is in <value1> or <value2>. A. proc format; value $<formatname> '<value1>'-'<value2>'='<label>'; run; B. proc format; value $<formatname> '<value1>'='<label>'; run; C. proc format; value $<formatname> '<value1>','<value2>'='<label>'; run; D. proc format; value $<formatname> other='<label>'; run;

C. proc format; value $<formatname> '<value1>','<value2>'='<label>'; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to specify a range with the proper use of operators. <> are omitted to make it easier to read operators. A. proc format; value <formatname>; low-< value ='<label>' value-value='<label>' value<-high='<label>'; run; B. proc format; value <formatname>; low-< value ='<label>'; value-value='<label>'; value<-high='<label>'; run; C. proc format; value <formatname> low-< value ='<label>' value-value='<label>' value<-high='<label>'; run; D. proc format; value <formatname> low to < value ='<label>' value to value='<label>' value< to high='<label>'; run;

C. proc format; value <formatname> low-< value ='<label>' value-value='<label>' value<-high='<label>'; run; Example: proc format; value money low-<25000 ='Less than 25,000' 25000-50000='25,000 to 50,000' 50000<-high='More than 50,000'; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency table that suppresses row percent. A. proc freq data=<libref>.<filename>; tables <var(s)>/nofreq; run; B. proc freq data=<libref>.<filename>; tables <var(s)>/nopercent; run; C. proc freq data=<libref>.<filename>; tables <var(s)>/norow; run; D. proc freq data=<libref>.<filename>; tables <var(s)>/nocol; run; E. proc freq data=<libref>.<filename>; tables <var(s)>/nocum; run; F. proc freq data=<libref>.<filename>; tables <var(s)>/list; run; G. proc freq data=<libref>.<filename> crosslist; tables <var(s)>/crosslist; run;

C. proc freq data=<libref>.<filename>; tables <var(s)>/nowor; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a two-way, or cross-tabular, frequency report for only two variables. A. proc freq data=<libref>.<filename>; tables <var1><*>(<var2> <var3>); run; B. proc freq data=<libref>.<filename>; tables (<var1> <var2>)<*>(<var3 <var4>); run; C. proc freq data=<libref>.<filename>; tables <var1><*><var2>; run; D. proc freq data=<libref>.<filename>; tables <var1>--<var3>; run; E. proc freq data=<libref>.<filename>; tables (<var1>--<var3>)<*><var4>; run; F. proc freq data=<libref>.<filename>; tables <var1><*><var2><*><var3>; run;

C. proc freq data=<libref>.<filename>; tables <var1><*><var2>; run; This will produce a frequency report that analyzes all possible combinations of the distinct two values of variables in one report. <var1> will be the ID and <var2> will be the column heading due to the order they happen in.

Select the proper syntax to perform the following instructions: Specify the proper syntax to import a file indicating how many rows SAS scans for variables to determine the type and length. A. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; delimiter='<value>'; run; B. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; datarow=<value>; run; C. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; guessingrows=<value>; run; D. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; getnames=<yes|no>; run;

C. proc import datafile='<filename>' dbms=dlm out=<libref>.<filename>; guessingrows=<value>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to produce a statistics report only showing the average values for the variables of the data set. A. proc means data=<libref>.<filename> median; run; B. proc means data=<libref>.<filename> n; run; C. proc means data=<libref>.<filename> mean; run; D. proc means data=<libref>.<filename> max; run; E. proc means data=<libref>.<filename> min; run;

C. proc means data=<libref>.<filename> mean; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to display simple descriptive statistics that groups sorted and non-sorted observations of the SAS data set for analysis. A. proc means data=<libref>.<filename>; var <var(s)>; run; B. proc means data=<libref>.<filename>; by <var(s)>; run; C. proc means data=<libref>.<filename>; class <var(s)>; run;

C. proc means data=<libref>.<filename>; class <var(s)>; run; The summary is displayed based on the order of the categories of the CLASS variable. Variables in the CLASS statement can be character or numeric. NOTE: Unlike using the BY statement, data do not need to be sorted prior to using the CLASS statement.

Select the proper syntax to perform the following instructions: Specify the proper syntax to display simple descriptive statistics that groups sorted observations of the SAS data set for analysis. A. proc means data=<libref>.<filename>; var <var(s)>; run; B. proc means data=<libref>.<filename>; <var(s)>; class <var(s)>; run; C. proc means data=<libref>.<filename>; var <var(s)>; by <var(s)>; run;

C. proc means data=<libref>.<filename>; var <var(s)>; by <var(s)>; run;

Select the proper syntax to perform the following instructions: Specify the proper Proc syntax that sorts the data by <var1> with an option so that there are no duplicate observations of the by variable. A. data <libref>.<filename>; set <libref>.<filename>; by <var1>; if first.<var1>; run; B. data <libref>.<filename>; set <libref>.<filename>; by <var1>; if <libref>.<var1>; run; C. proc sort data=<libref>.<filename> out=<libref>.<filename> nodupkey; by <var1>; run; D. proc sort data=<libref>.<filename> out=<libref>.<filename>; by <var1>; run;

C. proc sort data=<libref>.<filename> out=<libref>.<filename> nodupkey; by <var1>; run; Only one observation for each of the different values of the by variable will appear. has same results, but in data step: data <libref>.<filename>; set <libref>.<filename>; by <var1>; if first.<var1>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to output a summary to a SAS data set, without a report. A. proc freq data=<libref>.<filename>; run; B. proc summary data =<libref>.<filename> PRINT; C. proc summary data=<libref>.<filename>; output out=<libref>.<filename>; run; D. proc means data=<libref>.<filename>; run;

C. proc summary data=<libref>.<filename>; output out=<libref>.<filename>; run; Without either PRINT or an output out= you will get an: "ERROR: Neither the PRINT option nor a valid output statement has been given."

Select the proper syntax to perform the following instructions: Specify the proper syntax to compute the sum of variables 1-5, including any variables that may be between them. A. sum (<var1>-<var5>) B. sum (of <var1>-<var5>) C. sum (<var1>--<var5>) D. sum(<var1> <var2> <var3> <var4> <var5>)

C. sum (<var1>--<var5>) Example: if the input data set has four variables <var1>, <age>, <Var5>, <gender> then <var1>‐‐<var5> is the same as sum (<var1>, <age>, <var5>). NOTE: Missing values are ignored in the computation.

Select the proper syntax to perform the following instructions: Specify with special operators a way that selects observations by comparing character values to specified patterns. A. where <variable> between <value> and <value>; B. where <variable> ? '<value>'; C. where <variable> like '<value>_<value>%'; D. where <variable> =* '<value>'; E. where <variable> is <missing | null>;

C. where <variable> like '<value>_<value>%'; Like : selects observations by comparing character values to specified patterns. Other Special Operators: (%): replaces any number of characters. (_): replaces one character. Example: where Code like 'E_U%';

List the different DBMS Identifiers for proc import syntax. Proc Import Syntax example: Proc Import datafile='<filepath>' out=<libref>.<filename> DBMS=<identifier> Replace; Run;

CVS - comma-separated values: DBMS= is optional JMP - JMP files: DBMS=JMP TAB - tab-delimited values: DBMS=TAB (NOTE: Specify DBMS=DLM to import any other delimited file that doe not end in .CSV)

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a macro variable. A. &let<macro-var>=<value>; B. %let<macro-var>='<value>'; C. &let<macro-var>='<value>'; D. %let<macro-var>=<value>;

D. %let<macro-var>=<value>; <macro‐var> is either the name of a macro variable or a text expression that produces a macro variable name. The name can refer to a new or existing macro variable. <value> is a character string or a text expression. Omitting value produces a null value (0 characters). Leading and trailing blanks in value are ignored. You reference the macro variable that you created by using the name of the macro variable with an ampersand (&). An example is &macro‐variable. Note: If the macro variable has already been previously defined in the program, the value is replaced with the most current value.

Select the proper syntax to perform the following instructions: Specify the proper function that concatenates character strings, trims leading blanks, and left justifies. A. <var>=index(<source>, <excerpt>); B. <var>=tranwrd(<source>, <target>, <replacement>); C. <var>=compress(<source> ,<characters>, '<modifier(s)>'); D. <var>=catx('<delimiter>', <string>, <string>);

D. <var>=catx('<delimiter>', <string>, <string>); '<delimiter>' specifies the character string used for separating strings that will be concatenated. It must be in a quotation mark. The default length for an assignment using the CATX is 200. Example: Address = CATX(', ', CITY, STATE, ZIPCODE);

Select the proper syntax to perform the following instructions: Specify the proper function that concatenates character strings, trims leading blanks, and left justifies. Where <cl>=character list. A. substrn(<string>, <position> , <length>)=<var>; B. <var>=substrn(<string>, <position> , <length>); C. <var>=scan(<string>,<count>,<cl>,'<modifier>'); D. <var>=catx('<delimiter>', <string>, <string>); E. <var>=find(<string>, <substring> , <start-position> , '<modifier(s)>');

D. <var>=catx('<delimiter>', <string>, <string>); '<delimiter>' specifies the character string used for separating strings that will be concatenated. It must be in a quotation mark. The default length for an assignment using the CATX is 200. Example: Address = CATX(', ', CITY, STATE, ZIPCODE);

Select the proper syntax to perform the following instructions: Specify the proper function that removes multiple blanks from a character string by translating each occurrence of two or more consecutive blanks into a single blank. A. <var>=left(<string>); B. <var>=right(<string>); C. <var>=trim(<string>); D. <var>=compbl(<string>);

D. <var>=compbl(<string>);

Select the proper syntax to perform the following instructions: Specify the proper function that returns a random number in a normal manner. A. <var>=propcase(<string>); B. <var=>upcase(<string>); C. <var>=lowcase(<string>); D. <var>=rand('normal');

D. <var>=rand('normal'); Example: data randomtest; *A random number selected uniformly from 0 to 1.; randnum=rand('uniform'); *A random number selected uniformly from -5 to 5; randnum2=-5+10*rand('uniform'); *A random number selected from the normal distribution with mean 5 and variance 3; randnum3=rand('normal',5,3); run; uniform and normal use algorithmic formulas, not ranges to chose a number within.

Select the proper syntax to perform the following instructions: Specify the proper function to specify a variable equaling the current weekday of the week listed as an integer. A. <var>=day(<SASdate>); B. <var>=qtr(<SASdate>); C. <var>=year(<SASdate>); D. <var>=wekday(<SASdate>); E. <var>=month(<SASdate>);

D. <var>=wekday(<SASdate>); WEEKDAY(<SASdate>) gives the day of week (1 to 7; 1 is Sunday, and so on) The <SASdate> above can be a variable, a numeric constant or a date constant.

Select the proper syntax to perform the following instructions: Specify the proper function that calculates the date differences between two dates in years. A. <var>=datdif(<Start_date>, <End_date>, <basis_n/m>); B. <var>=datdif('<Start_date>', '<End_date>'); C. <var>=yrdif('<Start_date>', '<End_date>'); D. <var>=yrdif(<Start_date>, <End_date>, <basis_n/m>);

D. <var>=yrdif(<Start_date>, <End_date>, <basis_n/m>); Example: <var>=yrdif(2,9,1976 , 8,19,2006, 30/360); or <var>=yrdif(2,9,1976 , 8,19,2006, ACT/ACT); ACT specifies actual calendar dates rather than generalizing to 30 day months / 360 day years.

Select the proper syntax to perform the following instructions: Specify a procedure that drops or keeps a variable being used in the output data set, but are still available for processing. A. Data <libref>.<filename>; Set <libref>.<filename>(drop/keep=<var>); drop/keep <var>; run; B. Data <libref>.<filename>; drop/keep <var>; Set <libref>.<filename>(drop/keep=<var>); run; C. Data <libref>.<filename>; Set <libref>.<filename>(drop/keep=<var>); run; D. Data <libref>.<filename>(drop/keep=<var>); Set <libref>.<filename>; run;

D. Data <libref>.<filename>(drop/keep=<var>); Set <libref>.<filename>; run; example: Data work.newfile(drop=var1); Set work.newfile; if var1='yes'; run; (if statement no error as it is still available for processing)

Select the proper syntax to perform the following instructions: Specify the proper informat syntax to convert a time to an SAS date value. Assume the time is formatted hh:mm. A. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> mmddyy8.; run; B. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> date7.; run; C. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> yymmdd8.; run; D. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> time5.; run; E. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> datetime20.; run;

D. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> time5.; run; time5. is the lowest this can go for example hh:mm cannot be hhmm must be at least hh:mm to get seconds you must have hh:mm:ss cannot have mm:ss

Select the proper syntax to perform the following instructions: Specify the proper procedure to create a variable that shows the accumulated sum of variable 1 beginning with an initial value of 5. A. Data <libref>.<filename>; retain sumvar1 5; set <libref>.<filename>; sumvar1+<var1>=1; put id= <var1>= sumcvar1= ; Run; B. Data <libref>.<filename>; set <libref>.<filename>; sumvar1+<var1>; put id= <var1>= sumcvar1= ; Run; C. Data <libref>.<filename>; keep sumvar1 5; set <libref>.<filename>; sumvar1+<var1>; put id= <var1>= sumcvar1= ; Run; D. Data <libref>.<filename>; retain sumvar1 5; set <libref>.<filename>; sumvar1+<var1>; put id= <var1>= sumcvar1= ; Run;

D. Data <libref>.<filename>; retain sumvar1 5; set <libref>.<filename>; sumvar1+<var1>; Put id= <var1>= sumcvar1= ; Run; Example: Data SalesSums; retain sumq1 5 sumq2 10; set QuarterSales; Sumq1+q1; Sumq2+q2; Put id= q1= q2 = sumq1= sumq2= ; Run; The Retain Statement: Assigns an initial value to a retained value. Prevents variables from being initialized each time the data step executes.

Select the proper syntax to perform the following instructions: Read in a file from a specific location. (column # range ex: 1-4) A. Data <output set name>; infile <filepath>; input <Var> <column # range> <Var> <column # range>; run; B. Data <output set name>; infile '<filepath>'; put <Var> <column # range> <Var> <column # range>; run; C. Proc <output set name>; infile '<filepath>'; put <Var> <column # range> <Var> <column # range>; run; D. Data <output set name>; infile '<filepath>'; input <Var> <column # range> <Var> <column # range>; run;

D. Data <output set name>; infile '<filepath>'; input <Var> <column # range> <Var> <column # range>; run; Example: Data admit; infile 'C:\MATH610\RawData\RawData_txt\admit.txt'; input ID 1-4 Name $ 5-20 Gender $ 22 age 25-27; run; (use input <Var> <$> <column # range>; for charecter variables)

Select the proper syntax to perform the following instructions: Specify a procedure to create an Excel file with SAS. A. Proc <XLSXlibref>.<filename>; Set <libref>.<filename>; run; B. Data <XLSXlibref>.<filename>; Set <libref>.<filename>; run; Libname <XLSXlibref> clear; C. Data <XLSXlibref>.<filename>; Set <libref>.<filename>; run; D. Libname <XLSXlibref> '<filepath>.xlsx'; Data <XLSXlibref>.<filename>; Set <libref>.<filename>; run; Libname <XLSXlibref> clear;

D. Libname <XLSXlibref> '<filepath>.xlsx'; Data <XLSXlibref>.<filename>; Set <libref>.<filename>; run; Libname <XLSXlibref> clear; (The output statement can be used to specify a data set to write observations to. • The data set specified in the output statement must be listed in the data statement. • The _n_ variable is an automatic variable that is created in the Data step. SAS reads observations from input data sets one at a time. _n_ is the number of times the data step has read observations from the input data set. _n_ is not added to the created data set.)

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS destination with an <agrument> and actions assigned. A. ODS <action> <open-destination> <argument>; B. ODS <argument> <open-destination> <actions>; C. ODS <argument> <actions> <open-destination>; D. ODS <open-destination> <argument> <actions>;

D. ODS <open-destination> <argument> <actions>; Example: ODS HTML FILE='<filepath>' CLOSE; FILE= specifies the output file. can use a <fileref> reference if a FILENAME <fileref> '<filepath>'; statement has assigned a reference to that file. Actions: CLOSE - only one needed for base programming NOTE: FILE= and BODY= are interchangeable

Select the proper syntax to perform the following instructions: Use the Firstobs/Obs options locally in the proc print step. A. Proc Pint data=<libref>.<filename> options Firstobs=<n> Obs=<n> B. Proc Pint data=<libref>.<filename> (Firstobs=<n> Obs=<n>) C. Proc Pint data=<libref>.<filename> options Firstobs=<n> Obs=<n>; D. Proc Pint data=<libref>.<filename> (Firstobs=<n> Obs=<n>);

D. Proc Pint data=<libref>.<filename> (Firstobs=<n> Obs=<n>); example: Proc Print data=mylib.admit (Firstobs=5 Obs=15);

Select the proper syntax to perform the following instructions: Specify a procedure to print a SAS report with one variable as the first row of the report. A. Proc print data=<libref>.<filename> split='<character>'; run; B. Proc print data=<libref>.<filename> noobs; run; C. Proc print data=<libref>.<filename>; Var <variable(s)>; run; D. Proc print data=<libref>.<filename>; ID <variable(s)>; run;

D. Proc print data=<libref>.<filename>; ID <variable(s)>; run; (If a variable appears in both ID and VAR statements, the variable will be displayed TWICE.)

Select the proper syntax to perform the following instructions: Specify a procedure to sort a specified data file by variable(s) nonsorted. A. Proc sort data=<libref>.<filename> out=<libref>.<filename> nonsorted; By descending <variable(s)>; run; B. Proc sort data=<libref>.<filename> out=<libref>.<filename>; By ascending <variable(s)>; run; C. Proc sort data=<libref>.<filename> out=<libref>.<filename>; By descending <variable(s)>; run; D. Proc sort data=<libref>.<filename> out=<libref>.<filename>; By <variable(s)> nonsorted; run;

D. Proc sort data=<libref>.<filename> out=<libref>.<filename>; By <variable(s)> nonsorted; run; (nonsorted applies to all var in the by statement. can be specified anywhere in by statament. the requirement for ordering or indexing observations according to values of by variables is suspended when using nonsorted.)

Select the proper syntax to perform the following instructions: Write a message to the log. A statement used to find potential logical errors. A. Error = 'message'; B. Put 'message'; C. Log 'message'; D. Putlog 'message';

D. Putlog 'message'; (message specifies the message that you want to write to the SAS log. It can include character literals, variable names, formats, and pointer controls.) example: data work.Contribs; set mylib.Funddrive; AvgContrib = Mean(Q1+Q2+Q3+Q4); putlog Name= Q1= Q2= Q3= Q4= AvgContrib=; if AvgContrib < 20; run; proc print; format Q1 Q2 Q3 Q4 dollar3. AvgContrib dollar6.2; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a variable that indicates if a data set contributes to the current observation. A. data <libref>.<filename>; set <libref>.<filename>; <var>= in <libref>.<filename>; run; B. data <libref>.<filename>; set <libref>.<filename>; if in <var>; run; C. data <libref>.<filename>; set <libref>.<filename> in=<var>; run; D. data <libref>.<filename>; set <libref>.<filename>(in=<var>); run;

D. data <libref>.<filename>; set <libref>.<filename>(in=<var>); run; data work.output; set work.set(in=inset); run; Observations that are in work.set would have a value of one. If looking at more than one set observations not in work.set would have a value of zero.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a conditional iterative do loop to the specified increment specified as <value>. A. data <libref>.<filename>; set <libref>.<filename>; do until(<var>=<value>); <statement1> <statement2>; end; run; B. data <libref>.<filename>; set <libref>.<filename>; do until(<var>=<value>); <statement1>; <statement2>; close; run; C. data <libref>.<filename>; set <libref>.<filename>; do when(<var>=<value>); <statement1>; <statement2>; end; run; D. data <libref>.<filename>; set <libref>.<filename>; do until(<var>=<value>); <statement1>; <statement2>; end; run;

D. data <libref>.<filename>; set <libref>.<filename>; do until(<var>=<value>); <statement1>; <statement2>; end; run; can also use WHILE to get the inverse effect. Example: data invest; do until(Capital>1000000); Year+1; Capital+5000; Capital+(Capital*.075); end; run; same as data invest; do while(Capital<1000000); Year+1; Capital+5000; Capital+(Capital*.075); end; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to specify a permanent format with <x> being a numeric character used to define the format character length. A. proc print data=<libref>.<filename>; format <var> <format><x>.<x>; run; B. proc print data=<libref>.<filename>; format = <var> <format><x>.<x>; run; C. data <libref>.<filename>; set <libref>.<filename>; format = <var> <format><x>.<x>; run; D. data <libref>.<filename>; set <libref>.<filename>; format <var> <format><x>.<x>; run;

D. data <libref>.<filename>; set <libref>.<filename>; format <var> <format><x>.<x>; run; Format in the data step will be permanent and apply to data set output as well as the report. Once formatted in the data step any reports printed will also have variables in the new format.

Select the proper syntax to perform the following instructions: Specify the proper syntax to convert a character variable to numeric having 7 characters, two of which are decimals. A. data <libref>.<filename>; set<libref>.<filename>; <newvar>=put(<numvar>,7.2); run; B. data <libref>.<filename>; set<libref>.<filename>; <numvar>=put(<newvar>,7.2); run; C. data <libref>.<filename>; set<libref>.<filename>; <charvar>=input(<newvar>,7.2); D. data <libref>.<filename>; set<libref>.<filename>; <newvar>=input(<charvar>,7.2);

D. data <libref>.<filename>; set<libref>.<filename>; <newvar>=input(<charvar>,7.2); run; can also use dollar7.2 or comma7.2 if in that format

Select the proper syntax to perform the following instructions: Specify the proper procedure to interleave two data sets. A. data <libref>.<filename>; merge <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; B. data <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; run; C. data <libref>.<filename>; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; run; D. data SASdataset; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; E. proc append base = <libref>.<filename> data = <libref>.<filename>; run;

D. data SASdataset; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; Interleaving intersperses observations from two or more data sets, based on one or more common variables. The new data set includes all the variables from all the input data sets, and it contains the total number of observations from all input data sets. NOTE: The data values MUST be sorted on the by‐variable(s). You can use proc sort for this purpose.

Select the proper syntax to perform the following instructions: Specify the proper function that returns the integer part of the argument. A. floor(<argument>); B. round(<argument>,<round-off-unit>); C. ceil(<argument>); D. int(<argument>);

D. int(<argument>);

Select the proper syntax to perform the following instructions: Specify a libname statement options for reading EXCEL files that determines whether SAS will use the first row in an Excel worksheet as column names. A. libname <libref> '<filepath>' dbmax_text=n; B. libname <libref> '<filepath>' mixed=yes|no; C. libname <libref> '<filepath>' scantext=yes|no; D. libname <libref> '<filepath>' getnames = yes|no; E. libname <libref> '<filepath>' scantime=yes|no; F. libname <libref> '<filepath>' usedate=yes|no;

D. libname <libref> '<filepath>' getnames = yes|no; NOTE: It is common that an Excel sheet does not include variable names as the first case. If this is the case, use getnames=no;.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS destination with a table of contents and contents frame files created with an absolute URL link. A. ods <destination> body = '<folderpath><filename_b>' (url='<filename_b>') contents = '<folderpath><filename_c>' (url='filename_c') frame ='<folderpath><filename>'; ods <destination> close; B. ods <destination> body = '<folderpath><filename_b>' (url='<filename_b>') contents = '<folderpath><filename_c>' (url='filename_c') frame ='<folderpath><filename>' (url='<serverpath><filename_f>'); ods <destination> close; C. ods <destination> body = '<folderpath><filepath_b>' (url='<serverpath><filename_b>') contents = '<folderpath><filepath_c>' (url='<serverpath><filename_c>') frame ='<folderpath><filepath>' (url='<serverpath><filename_f>'); ods <destination> close; D. ods <destination> body = '<folderpath><filepath_b>' (url='<serverpath><filename_b>') contents = '<folderpath><filepath_c>' (url='<serverpath><filename_c>') frame ='<folderpath><filepath>'; ods <destination> close;

D. ods <destination> body = '<folderpath><filepath_b>' (url='<serverpath><filename_b>') contents = '<folderpath><filepath_c>' (url='<serverpath><filename_c>') frame ='<folderpath><filepath>'; ods <destination> close; Example: ods html body = 'C:\Math610\report\areport4.html' (URL ='https://cms.bsu.edu/Math499/ areport5.html') contents = 'C:\Math610\report\cont4.html' (url='https://cms.bsu.edu/Math499/cont4.html') frame ='C:\Math610\report\frame4.html'; This creates hyperlinks to specific locations. This ODS statement creates: 1. A frame file 'C:\Math610\report\frame4.html' that has links to 'https://cms.bsu.edu/Math499/cont4.html' and url='https://cms.bsu.edu/Math499/cont4.html'; 2. A contents file 'C:\Math610\report\cont4.html' that has links to 'https://cms.bsu.edu/Math499/ areport5.html'. If files are moved from the absolute file path specified they will not work. NOTE: Same as Path='<folderpath>' body=<filename>

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination. A. ods html <(<ID=> identifier)> <options>; B. ods rtf <(<ID=> identifier)> <options>; C. ods pdf <(<ID=> identifier)> <option(s)>; D. ods excel <(<ID=>identifier)> <option(s)>;

D. ods excel <(<ID=>identifier)> <option(s)>; (<ID=>identifier) enables you to open multiple instances of the same destination at the same time. Each instance can have different options.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination with the option that creates a new worksheet for each BY group. A. ods excel file= '<filepath>' (embedded_titles='yes|no'); B. ods excel file= '<filepath>' (sheet_label='<value>'); C. ods excel (suppress_bylines='yes|no'); D. ods excel file= '<filepath>' (sheet_interval="bygroup"); E. ods excel file= '<filepath>' (sheet_name='<value>');

D. ods excel file= '<filepath>' (sheet_interval="bygroup");

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination with actions to include only files that contain a file path of <value> in the output. A. ods excel select ALL; B. ods excel select where=(_path_ ='filepath'); C. ods excel select NONE; D. ods excel select where=(_path_ ? "<value>" );

D. ods excel select where=(_path_ ? "<value>" ); Example: ods excel select where=(_path_ ? "Diastolic" ); included only files that contain <Diastolic>. ods excel select ALL; resets to default output, all included. ods excel select NONE; temporarily suspends output. Note: The default is ALL. A destination must be open for this action to take effect.

Select the proper syntax to perform the following instructions: Specify the proper syntax for the proc step that identifies extreme and missing values. A. proc freq data=<libref>.<filename>; run; B. proc means data=<libref>.<filename> noprint; run; C. proc print data=<libref>.<filename>; run; D. ods select ExtremeObs; proc univariate data=<libref>.<filename>; run;

D. ods select ExtremeObs; proc univariate data=<libref>.<filename>; run; PROC UNIVARIATE produces tables of moments, basic statistical measures, tests for location, quantiles, and extreme observations. The ODS SELECT statement restricts the output to the "ExtremeObs" table;

Select the proper syntax to perform the following instructions: Specify a procedure that reads data from an external data source XLSX file and writes it to a SAS data set. A. options validvarname=v7; Proc Import datafile='<filepath.xlsx>'; out=<libref>.<filename>; sheet=<sheetname>; getnames=<yes/no>; run; B. options validvarname=v7; Proc Import infile='<filepath.xlsx>' out=<libref>.<filename> sheet=<sheetname>; getnames=<yes/no>; run; C. options validvarname=v7; Proc Import infile='<filepath.xlsx>'; out=<libref>.<filename>; sheet=<sheetname>; getnames=<yes/no>; run; D. options validvarname=v7; Proc Import datafile='<filepath.xlsx>' out=<libref>.<filename> sheet=<sheetname>; getnames=<yes/no>; run;

D. options validvarname=v7; Proc Import datafile='<filepath.xlsx>' out=<libref>.<filename> sheet=<sheetname>; getnames=<yes/no>; run; (options validvarname=v7; forces SAS to convert spaces to underscores when it converts column names to variables. sheet=<sheetname>; option imports specific worksheets from an Excel workbook. getnames=yes; statement generates variable names from the first row of data.) NOTE: Use proc contents to display the descriptor portion of the out=<libref>.<filename> data set.

Select the proper syntax to perform the following instructions: Specify a procedure that reads data from an external data source TAB-delimited file and writes it to a SAS data set. A. options validvarname=v7; Proc Import infile='<filepath>'; dbms=tab; out=<libref>.<filename>; replace; delimiter='09'x;run; B. options validvarname=v7; Proc Import infile='<filepath>' dbms=csv out=<libref>.<filename> replace; delimiter='09'x;run; C. options validvarname=v7; Proc Import datafile='<filepath>'; dbms=tab; out=<libref>.<filename>; replace; delimiter='09'x;run; D. options validvarname=v7; Proc Import datafile='<filepath>' dbms=tab out=<libref>.<filename> replace; delimiter='09'x;run;

D. options validvarname=v7; Proc Import datafile='<filepath>' dbms=tab out=<libref>.<filename> replace; delimited='09'x;run; example: options validvarname=v7; Proc Import datafile='C;\Math610\file.txt' dbms=tab out=work.newfile replace; delimiter='09'x;run; (delimiter='09'x; A tab is specified by its hexadecimal value. For ASCII systems (UNIX, Windows, and Linux), the value is '09'x. For EBCDIC systems (z/OS and MVS), the value is '05'x.)

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a user-defined numeric format in a temporary catalog. A. proc format <options>; <format name> <range>='<label>'; value; run; B. proc format <options>; <format name> value <range>='<label>'; run; C. proc format <options>; value $<format name> <range>='<label>'; run; D. proc format <options>; value <format name> <range>='<label>'; run;

D. proc format <options>; value <format name> <range>='<label>'; run; proc format; value gender 1='Female' 2='Male' other='Miscoded'; run; other indicates anything other than a range of equal to one or two.

Select the proper syntax to perform the following instructions: Specify the proper syntax to specify a range so that the variable is formatted to '<label>' if it is in anything besides <value1> and <value2>. A. proc format; value $<formatname> '<value1>'-'<value2>'='<label>'; run; B. proc format; value $<formatname> '<value1>'='<label>'; run; C. proc format; value $<formatname> '<value1>','<value2>'='<label>'; run; D. proc format; value $<formatname> other='<label>'; run;

D. proc format; value $<formatname> other='<label>'; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a frequency table with options to display the distinct count for each variable listed in the tables statement. A. proc freq data=<libref>.<filename> levels freq=order; tables <var1> <var2>; run; B. proc freq data=<libref>.<filename> nlevels order=freq; tables <var1> <var2>; run; C. proc freq data=<libref>.<filename> levels; tables <var1> <var2>; run; D. proc freq data=<libref>.<filename> nlevels; tables <var1> <var2>; run;

D. proc freq data=<libref>.<filename> nlevels; tables <var1> <var2>; run; NOTE: If TABLES statement is omitted, by default it will display for all variables in that dataset.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency table that suppresses cumulative frequency and column percentage. A. proc freq data=<libref>.<filename>; tables <var(s)>/nofreq; run; B. proc freq data=<libref>.<filename>; tables <var(s)>/nopercent; run; C. proc freq data=<libref>.<filename>; tables <var(s)>/norow; run; D. proc freq data=<libref>.<filename>; tables <var(s)>/nocol; run; E. proc freq data=<libref>.<filename>; tables <var(s)>/nocum; run; F. proc freq data=<libref>.<filename>; tables <var(s)>/list; run; G. proc freq data=<libref>.<filename> crosslist; tables <var(s)>/crosslist; run;

D. proc freq data=<libref>.<filename>; tables <var(s)>/nocol; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency report for <var1> <var2> and <var3>. A. proc freq data=<libref>.<filename>; tables <var1><*>(<var2> <var3>); run; B. proc freq data=<libref>.<filename>; tables (<var1> <var2>)<*>(<var3 <var4>); run; C. proc freq data=<libref>.<filename>; tables <var1><*><var2>; run; D. proc freq data=<libref>.<filename>; tables <var1>--<var3>; run; E. proc freq data=<libref>.<filename>; tables (<var1>--<var3>)<*><var4>; run; F. proc freq data=<libref>.<filename>; tables <var1><*><var2><*><var3>; run;

D. proc freq data=<libref>.<filename>; tables <var1>--<var3>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to produce a statistics report only showing the largest value for the variables of the data set. A. proc means data=<libref>.<filename> median; run; B. proc means data=<libref>.<filename> n; run; C. proc means data=<libref>.<filename> mean; run; D. proc means data=<libref>.<filename> max; run; E. proc means data=<libref>.<filename> min; run;

D. proc means data=<libref>.<filename> max; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to display simple descriptive statistics for the numeric variables in a SAS data set rounded to 3 decimals. A. proc means data=<libref>.<filename> maxdec=12.3; run; B. proc means data=<libref>.<filename> maxdec=best.3; run; C. proc means data=<libref>.<filename>; run; D. proc means data=<libref>.<filename> maxdec=3; run;

D. proc means data=<libref>.<filename> maxdec=3; run; By default, PROC MEANS uses the BESTw. format to display values in the report. Using this format values can be reported to many decimal places such as 52.000000

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a new SAS data set consisting only of the summary statistics calculated by PROC MEANS that does not automatically print a report. A. proc means data=<libref>.<filename> noprint; var <var1> <var2> <var3>; output out=<libref>.<filename>; mean = <var1M> <var2M> <var3M>; std = <var1std> <var2std> <var3std>; run; B. proc means data=<libref>.<filename>; var <var1> <var2> <var3>; output out=<libref>.<filename>; mean = <var1M> <var2M> <var3M> std = <var1std> <var2std> <var3std>; run; C. proc means data=<libref>.<filename> noprint; var <var1> <var2> <var3>; output =<libref>.<filename>; mean = <var1M> <var2M> <var3M> std = <var1std> <var2std> <var3std>; run; D. proc means data=<libref>.<filename> noprint; var <var1> <var2> <var3>; output out=<libref>.<filename>; mean = <var1M> <var2M> <var3M> std = <var1std> <var2std> <var3std>; run;

D. proc means data=<libref>.<filename> noprint; var <var1> <var2> <var3>; output out=<libref>.<filename>; mean = <var1M> <var2M> <var3M> std = <var1std> <var2std> <var3std>; run; This creates a new data set but does not print a report of that data set unless otherwise specified with a proc print step for the new data set.

Select the proper syntax to perform the following instructions: Specify the proper syntax to display simple descriptive statistics for the numeric variables in a SAS data set. A. proc freq data=<libref>.<filename>; run; B. proc summary data =<libref>.<filename> PRINT; C. proc contents data=<libref>.<filename>; run; D. proc means data=<libref>.<filename>; run;

D. proc means data=<libref>.<filename>; run; If use NOPRINT option, same result as PROC SUMMARY.

Select the proper syntax to perform the following instructions: Specify a procedure to generate a subtotal. A. proc print data = <libref>.<filename>; var <variables>; Total <variable(s)>; run; B. proc print data = <libref>.<filename>; var <variables>; Sum <variable(s)>; run; C. proc print data = <libref>.<filename>; var <variables>; Total <variable(s)>; By <variables>; run; D. proc print data = <libref>.<filename>; var <variables>; Sum <variable(s)>; By <variables>; run;

D. proc print data = <libref>.<filename>; var <variables>; Sum <variable(s)>; By <variables>; run; Example: proc print data = mylib.file; sum fee; by actlevel nonsorted; run; (NOTSORTED option specifies that observations on variables in the by statement are not necessarily sorted. With the NONSORTED option the procedure treats each contiguous set of same valued observations as a separate group. • If you DO NOT use the NOSORTED option then the data set MUST be sorted on the by variables. If the data is not sorted on the by variables then you can sort the data set using PROC SORT prior to using the BY statement in the PROC PRINT procedure.)

Select the proper syntax to perform the following instructions: Specify a procedure to generate a subtotal on separate pages. A. proc print data = <libref>.<filename>; var <variable(s)>; total <variable(s)>; by <variable(s)>; run; B. proc print data = <libref>.<filename>; var <variable(s)>; sum <variable(s)>; by <variable(s)>; run; C. proc print data = <libref>.<filename>; var <variable(s)>; total <variable(s)>; by <variable(s)>; run; pageby <variable>; sum <variable(s)>; run; D. proc print data = <libref>.<filename>; var <variable(s)>; by <variable(s)>; pageby <variable>; sum <variable(s)>; run;

D. proc print data=<libref>.<filename>; by <variable1>; pageby <variable1>; sum <variable 2>; run;

Select the proper syntax to perform the following instructions: Specify a procedure to generate a grand total. A. proc print data = <libref>.<filename>; var <variable(s)>; Total <variable(s)>; By <variable(s)>run; B. proc print data = <libref>.<filename>; var <variable(s)>; Sum <variable(s)>; By <variable(s)>; run; C. proc print data = <libref>.<filename>; var <variable(s)>; Total <variable(s)>; By <variable(s)>; Sum <variable(s)>; run; D. proc print data = <libref>.<filename>; var <variable(s)>; By <variable(s)>; Sum <variable(s)>; run;

D. proc print data=<libref>.<filename>; by <variable1>; sum <variable 2>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a dollar variable format with 10 characters two of which are decimals. A. proc print data=<libref>.<filename>; format <var> dollar8.2; run; B. proc print data=<libref>.<filename>; format <var> dollar102; run; C. proc print data=<libref>.<filename>; format <var> dollar 10.2; run; D. proc print data=<libref>.<filename>; format <var> dollar10.2; run;

D. proc print data=<libref>.<filename>; format <var> dollar10.2; run;

Select the proper syntax to perform the following instructions: Specify with special operators a way selects observations that contain spelling variations of the word or words specified. A. where <variable> between <value> and <value>; B. where <variable> ? '<value>'; C. where <variable> like '<value>_<value>%'; D. where <variable> =* '<value>'; E. where <variable> is <missing | null>;

D. where <variable> =* '<value>'; sounds like (=*) : operator selects observations that contain spelling variations of the word or words specified. Example: where Name =* 'SMITH';

(Drop=<var>)and (Keep=<var>)data set options What is the difference between: Data statement option Vs Set statement option

Data Statement (Drop=<var>)/(Keep=<var>): Drops/Keeps Variable in the new data set. (If you need to reference a variable for a statement for calculations or statements, but do not want it to show up on a report you could use drop in the data statement.) Set Statement (Drop=<var>)/(Keep=<var>): Prevents variables from being read in or keeps them to be read in. These will not appear in the new data set.

Select the proper syntax to perform the following instructions: Specify the proper function that searches for a specific substring within a character value and returns the substring's starting position. Where <cl>=character list. A. substrn(<string>, <position> , <length>)=<var>; B. <var>=substrn(<string>, <position> , <length>); C. <var>=scan(<string>,<count>,<cl>,'<modifier>'); D. <var>=catx('<delimiter>', <string>, <string>); E. <var>=find(<string>, <substring> , <start-position> , '<modifier(s)>');

E. <var>=find(<string>, <substring> , <start-position> , '<modifier(s)>'); <string> specifies a character constant, variable or expression that will be searched for substrings. <substring> is a character constant, variable or expression that is enclosed in quotation marks to be searched for in the string. <startposition> is an integer that specifies the position at which the search should start and the direction of the search, deafualt forward (left to right). If <startpostion> is negative is searches backward starting at the integer. If <startposition> is not given, FIND searches from left to right starting from 1st position.

Select the proper syntax to perform the following instructions: Specify the proper function to specify a variable equaling the current month of the year listed as an integer. A. <var>=day(<SASdate>); B. <var>=qtr(<SASdate>); C. <var>=year(<SASdate>); D. <var>=wekday(<SASdate>); E. <var>=month(<SASdate>);

E. <var>=month(<SASdate>); MONTH(<SASdate>) gives the month of the date (1 to 12) The <SASdate> above can be a variable, a numeric constant or a date constant.

Select the proper syntax to perform the following instructions: Specify the proper informat syntax to convert a datetime to an SAS date value. Assume the time is formatted ddmmmyyyy:hh:mm:ss.s A. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> mmddyy8.; run; B. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> date7.; run; C. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> yymmdd8.; run; D. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> time5.; run; E. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> datetime20.; run;

E. Data <libref>.<filename>; infile '<filepath>'; input 1-8 <var> datetime20.; run;

Select the proper syntax to perform the following instructions: Specify a libname statement options for reading EXCEL files that determines whether to scan all row values in a date/time column and automatically determine the TIME format if only time values exist. A. libname <libref> '<filepath>' dbmax_text=n; B. libname <libref> '<filepath>' mixed=yes|no; C. libname <libref> '<filepath>' scantext=yes|no; D. libname <libref> '<filepath>' getnames = yes|no; E. libname <libref> '<filepath>' scantime=yes|no; F. libname <libref> '<filepath>' usedate=yes|no;

E. libname <libref> '<filepath>' scantime=yes|no; NOTE: Default = no. If specify yes, columns with only time values will be assigned the TIME8. format. If specify no, columns with only time values will be assigned the DATE9. format.

Select the proper syntax to perform the following instructions: Specify the proper syntax to open an ODS excel destination with the option that customizes the worksheet name. A. ods excel file= '<filepath>' (embedded_titles='yes|no'); B. ods excel file= '<filepath>' (sheet_label='<value>'); C. ods excel (suppress_bylines='yes|no'); D. ods excel file= '<filepath>' (sheet_interval="bygroup"); E. ods excel file= '<filepath>' (sheet_name='<value>');

E. ods excel file= '<filepath>' (sheet_name='<value>'); Worksheet name in output will be stated as <value>

Select the proper syntax to perform the following instructions: Specify the proper procedure to append a data set to another. A. data <libref>.<filename>; merge <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; B. data <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; set <libref>.<filename>; run; C. data <libref>.<filename>; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; run; D. data SASdataset; set <libref>.<filename> <libref>.<filename> <libref>.<filename>; by <var(s)>; run; E. proc append base = <libref>.<filename> data = <libref>.<filename>; run;

E. proc append base = <libref>.<filename> data = <libref>.<filename>; run; Only two data sets can be used at a time, a base= data set and a data= data set. The observations of the data= data set are appended to the base= data set. No new SAS data set is created and the observations of the base= data set are not read. The variable information in the descriptor portion of the base= data set does not change. Append is a proc step, not a data step, but it does not create a report rather it appends observations to the base data set. Note: If you have data that you would like to append you might create a copy to use as the base= data set so that your original data set does not get altered.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a two-way, or cross-tabular, frequency report for <var1><*><var4> <var2><*><var4> and <var3><*><var4>. A. proc freq data=<libref>.<filename>; tables <var1><*>(<var2> <var3>); run; B. proc freq data=<libref>.<filename>; tables (<var1> <var2>)<*>(<var3 <var4>); run; C. proc freq data=<libref>.<filename>; tables <var1><*><var2>; run; D. proc freq data=<libref>.<filename>; tables <var1>--<var3>; run; E. proc freq data=<libref>.<filename>; tables (<var1>--<var3>)<*><var4>; run; F. proc freq data=<libref>.<filename>; tables <var1><*><var2><*><var3>; run;

E. proc freq data=<libref>.<filename>; tables (<var1>--<var3>)<*><var4>; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency table that suppresses cumulative frequency and cumulative percentage. A. proc freq data=<libref>.<filename>; tables <var(s)>/nofreq; run; B. proc freq data=<libref>.<filename>; tables <var(s)>/nopercent; run; C. proc freq data=<libref>.<filename>; tables <var(s)>/norow; run; D. proc freq data=<libref>.<filename>; tables <var(s)>/nocol; run; E. proc freq data=<libref>.<filename>; tables <var(s)>/nocum; run; F. proc freq data=<libref>.<filename>; tables <var(s)>/list; run; G. proc freq data=<libref>.<filename> crosslist; tables <var(s)>/crosslist; run;

E. proc freq data=<libref>.<filename>; tables <var(s)>/nocum; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to produce a statistics report only showing the smallest value for the variables of the data set. A. proc means data=<libref>.<filename> median; run; B. proc means data=<libref>.<filename> n; run; C. proc means data=<libref>.<filename> mean; run; D. proc means data=<libref>.<filename> max; run; E. proc means data=<libref>.<filename> min; run;

E. proc means data=<libref>.<filename> min; run;

Select the proper syntax to perform the following instructions: Specify with special operators a way to select observations in which the value of the variable is missing. A. where <variable> between <value> and <value>; B. where <variable> ? '<value>'; C. where <variable> like '<value>_<value>%'; D. where <variable> =* '<value>'; E. where <variable> is <missing | null>;

E. where <variable> is <missing | null>; IS NULL or IS MISSING : selects observations in which the value of the variable is missing. Example: where Flight is missing; where Flight is null;

List Comparison Operators

EQ or = : equal to NE, ~=, or ^= : not equal to GT or > : greater than LT or < : less than GE or >= : greater than or equal to LE or <= : less than or equal to IN : equal to one of a list

When ODS generates files for the body, contents, and frame it also generates links between the files using the HTML file names you specify.

Example: ods html body = 'C:\Math610\report\areport4.html' contents = 'C:\Math610\report\cont4.html' frame ='C:\Math610\report\frame4.html'; ods hmtl close; The ODS statement in Program creates: 1. A frame file 'C:\Math610\report\frame4.html' that has links to 'C:\Math610\report\cont4.html' and 'C:\Math610\report\areport4.html'. 2. A contents file 'C:\Math610\report\cont4.html' that has links to 'C:\Math610\report\areport4.html'.

Select the proper syntax to perform the following instructions: Specify a libname statement options for reading EXCEL files that determines whether to use DATE9. format for date/time values in Excel workbooks. A. libname <libref> '<filepath>' dbmax_text=n; B. libname <libref> '<filepath>' mixed=yes|no; C. libname <libref> '<filepath>' scantext=yes|no; D. libname <libref> '<filepath>' getnames = yes|no; E. libname <libref> '<filepath>' scantime=yes|no; F. libname <libref> '<filepath>' usedate=yes|no;

F. libname <libref> '<filepath>' usedate=yes|no; NOTE: Default = yes. If specify yes, the format is DATE9. If specify no, the format is DATETIME.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency table that produces one table listed by variable order in tables and gives Frequency, Percent, Cumulative Frequency, Cumulative Percent for each combination of variables. A. proc freq data=<libref>.<filename>; tables <var(s)>/nofreq; run; B. proc freq data=<libref>.<filename>; tables <var(s)>/nopercent; run; C. proc freq data=<libref>.<filename>; tables <var(s)>/norow; run; D. proc freq data=<libref>.<filename>; tables <var(s)>/nocol; run; E. proc freq data=<libref>.<filename>; tables <var(s)>/nocum; run; F. proc freq data=<libref>.<filename>; tables <var(s)>/list; run; G. proc freq data=<libref>.<filename> crosslist; tables <var(s)>/crosslist; run;

F. proc freq data=<libref>.<filename>; tables <var(s)>/list; run;

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a two-way, or cross-tabular, frequency report for <var2><*><var3> for each observation value of <var1>. A. proc freq data=<libref>.<filename>; tables <var1><*>(<var2> <var3>); run; B. proc freq data=<libref>.<filename>; tables (<var1> <var2>)<*>(<var3 <var4>); run; C. proc freq data=<libref>.<filename>; tables <var1><*><var2>; run; D. proc freq data=<libref>.<filename>; tables <var1>--<var3>; run; E. proc freq data=<libref>.<filename>; tables (<var1>--<var3>)<*><var4>; run; F. proc freq data=<libref>.<filename>; tables <var1><*><var2><*><var3>; run;

F. proc freq data=<libref>.<filename>; tables <var1><*><var2><*><var3>; run; Example: TABLES A*B*C; Produces separate two-way tables of B*C for each value of A.

Select the proper syntax to perform the following instructions: Specify the proper syntax to create a one-way frequency table that produces separate listing frequency tables controlled by Var1. A. proc freq data=<libref>.<filename>; tables <var(s)>/nofreq; run; B. proc freq data=<libref>.<filename>; tables <var(s)>/nopercent; run; C. proc freq data=<libref>.<filename>; tables <var(s)>/norow; run; D. proc freq data=<libref>.<filename>; tables <var(s)>/nocol; run; E. proc freq data=<libref>.<filename>; tables <var(s)>/nocum; run; F. proc freq data=<libref>.<filename>; tables <var(s)>/list; run; G. proc freq data=<libref>.<filename> crosslist; tables <var(s)>/crosslist; run;

G. proc freq data=<libref>.<filename>; tables <var(s)>/crosslist; run; Each separate table uses listing format in the order of Var2, Var3 and returns frequency, percent, row percent, column percent for each combination of values of (Var2, Var3).

Select the proper syntax to perform the following instructions: Proper use of the delete statement.

If <var>=20 then delete; This deletes all observations in which <var> are equal to 20.

Select the proper syntax to perform the following instructions: The following syntax will produce a report of which statistics? proc means data=<libref>.<filename>; run;

N, MEAN, STD, MIN, and MAX NOTE: excludes missing values in calculating statistics

What are the default variable lengths?

Stored variable values have lengths in terms of # of bytes. • A character variable value can be up to 32767 bytes long. • All numeric variables have a default variable length of 8 bytes, unless specified otherwise and are stored in stored in floatingpoint.

The filename statement can also reference a file of raw data files.

Syntax to reference to a GROUP of external raw data files: FILENAME <fileref> '<folderpath>'; Ex: FILENAME EXT_TXT 'C:\Math610\RawData\RawData_txt';

What syntax is used within the DATA step to overwrite an existing SAS data set.

Syntax: DATA <libref>.<filename> (REPLACE=YES/NO) SET <libref>.<filename>; run; example: Data cert.admit(Replace=yes); set cert.admit; run; (This will replace the current SAS file with the new sas file and any changes made in the data step. (Replace=No) is the default.) The REPLACE system option only applies to permanent SAS data sets, not temporary.

What syntax is used within the Proc Import step to overwrite an existing SAS data set.

Syntax: Proc Import datafile='<filepath>' out=<libref>.<filename> DBMS=<identifier> Replace; Run; (If you omit <REPLACE> the import procedure does not overwrite an existing SAS data set. Instead, use a SAS DATA Step with the REPLACE= data set options to replace a permanent SAS data set.) The REPLACE system option only applies to permanent SAS data sets, not temporary.

Drop/Keep Vs (Drop=)/(Keep=)

The DROP and KEEP statements apply to all output data sets Variables dropped with a DROP statement are read into the PDV but are not output to the new SAS data set. They are available for processing during the DATA step Variables which are not kept with a KEEP statement are read into the PDV but are not output to the new SAS data set. They are available for processing during the DATA step DROP= and KEEP= data set options can apply to both input and output SAS data sets

Select the proper syntax to perform the following instructions: How do you remove titles?

The null TITLE statement, title; , cancels all titles. (same for footnotes) NOTE: Titles remain effect until they are changed, cancelled, or you end your SAS session.

What does the option fmtlib do in the following syntax? proc format fmtlib; value <formatname>; <range>='<label>'; run;

The option FMTLIB lists and gives details about all of the formats in the format catalog reference in the PROC FORMAT procedure. NOTE: a report is generated automatically with this option. A print procedure is not needed to view the details.

Defining automatic variables _N_ and _Error_ and the put statement

_N_ :The number of times the DATA step iterated _ERROR_ :Initialized to 0, set to 1 when an error occurs (The variables are automatically and are used in the data step for processing, but they are not written out to the data set being created.) Syntax example: PUT specification; specification - specifies what is written, how it is written and where it is written. Examples of specifications: • A character string • One or more data set variables • The automatic variables _N_ and _Error_ • The automatic variable _ALL_

What does the option fmtlib do in the following syntax? proc format lib= <libref> fmtlib; run;

list your formats in the <libref>.formats catalog. NOTE: The user‐defined format is saved in a format catalog. In this case the format catalog has the two‐level name <libref>.formats.

Select the proper syntax to perform the following instructions: Specify a procedure to specify a variable in the BY and ID statements to change the report format.

proc print data=<libref>.<filename>; by <var1>; id <var1>; sum <var2>; run;

What are the rules for defining a proper SAS Data Set name?

• 1 to 32 characters in length • start with a letter (A through Z) or an underscore (_) • continues with any combination of numbers, letters, or underscores • Stored in mixedcase. Not case sensitive when referring to or processing data set.

Other variable info

• A variable's format is the format when writing the variable out of the SAS data set. • A variable's informat is the specific format for reading the variable into a standard SAS value. • A variable's label is a name given to the variable in reports. It can be up to 256 characters.


Conjuntos de estudio relacionados

MARK TWAIN 7A EARTH SCIENCE HONORS ROCKS AND MINERALS EXAM

View Set

Section 4 Lesson 1: Supertypes and Subtypes

View Set

AutoCAD certification exam study guide

View Set

Unit 5: Agriculture and Rural Land-Use Patterns and Processes

View Set

Restructuring/distressed M&A Notes

View Set

10. Energy Commodity Exchanges, OTC Derivative

View Set

iec year 2, quarter 2 final exam

View Set