The following SAS program is submitted: data work.month; date = input('13mar2000',date9.); run; Which one of the following represents the type and length of the variable DATE in the output data set?
Correct Answer : Get Lastest Questions and Answer : As input function converts character variable to numeric variables and numeric variables are always stored in 8 bytes. Input function converts character data to numeric. Numbers are always stored in 8 byte even when number is as low as 0 or as high as 10000000...
So correct answer is A, date will be numeric variable with 8 byte length.
Question :
The following SAS program is submitted: data work.products; Product_Number = 5461; Item = '1001'; Item_Reference = Item'/'Product_Number; run; Which one of the following is the value of the variable ITEM_REFERENCE in the output data set? 1. 1001/5461 2. 1001/ 5461 3. Access Mostly Uused Products by 50000+ Subscribers 4. The value cannot be determined as the program fails to execute due to errors.
Correct Answer : Get Lastest Questions and Answer : Explanation: The program fails to execute due to errors. Since there is no concatenate symbol between them. 133 Item_Reference = Item '/' Product_Number; --- -------------- 388 202 ERROR 388-185: Expecting an arithmetic operator. ERROR 202-322: The option or parameter is not recognized and will be ignored. 1) Item_Reference = Item'/'Product_Number; SAS tries to solve it as an arithmetic operation but quotation puzzles SAS as it expects arithmetic operator here Ans: 4. The value can not be determined as the program fails to execute due to errors.
(2) Item_Reference = Item/Product_Number; Just removing qoutation marks Ans: Value of Item_Reference is 0.1832997619
(3) Item_Reference = Item||'/'||Product_Number; Just adding concatenating operator Ans : B. 1001/ 5461
To get the output as given in option 1 Ans: . 1001/5461
Question : The following SAS program is submitted: data work.retail; cost = '20000'; total = .10 * cost; run; Which one of the following is the value of the variable TOTAL in the output data set?
Explanation: to an extent, SAS automatically converts character to numeric. Even though cost is character due to automatic conversion here we are getting 2000 Because the character value is automaticaly converted to numberic by SAS.
Here's the log results "NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column)" cost is automatically converted to numeric.
To avoid seeing this message in log- Character values have been converted to numeric values at the places given by: (Line):(Column).
You can explicitly convert the character values of char variable (in this case cost to numeric values by using the INPUT function.) use informat with input. here informat is 5 becoz 20000 value: use this prgm- msg will disappear from log. as a good programmer, your log be clear. data work.retail; cost = '20000'; total = .10 * cost; run; *char values converted to num in log- to avoid this msg, give input stmt;
data work.retail1; cost = '20000'; cost1= input (cost, 5.); total = .10 * cost1; run;
1. @n 2. #n 1. +n 2. / Ans : 2 Exp : The #n line pointer control is used to read records non-sequentially. The #n specifies the absolute number of the line to which you want to move the pointer.
Question : While creating user defined format and you want to specify particular label for a particular value in data set. What is the maximum possible character length for a label?