//
archives

SAS QUIZ.

This category contains 20 posts

SAS Quiz Question 1 :


Here is a dataset of answers to 5 questions from customer survey.
Only A,B,C,D, and E are valid values for the answers.

data qest;
     input cusmid $ (answ1 – answ5) ($1. +1);
datalines;
001 A D C A B
002 b A C A D
003 C C D F B
004 S C B E B
005 E A C E e
006 B a c e B
007 N A D A C
008 A S W B B
009 D A E E B
010 Z B V F B
;
run;

a. Convert all low case letters into upper cases letters respectively.
b. Create a variable of INVALNUM to count the number of invalid values
   of each customer’s ID using ARRAY statement.

like

Advertisements

When you use the subsetting IF statement, how are observations excluded?


a.  If the expression is true, SAS excludes the observation from the input data set.

b.  If the expression is false, SAS excludes the observation from the output data set.

c.  If the expression is false, SAS excludes the observation from the PDV.

d.  If the expression is true, SAS excludes the observation from the PDV.

 

Ans :

Try if you can solve :


Data details. It is a free text field so user has given more than one Email address with various delimiter like space, comma, semicolon, colon and other. Below is the sample of values stored:-

ravi@Gmail.com, mandal@hotmail.com
deepak@outlook.com deepak@gmail.com
Rohit@sify.com

Can you help me to extract Email address and store it delimited by semicolon only to other variable?

 

Thanks in Advanced.

Try if you can :


Required Output :

image

Raw data :

Note : Data is taken from  http://quicknet.in/entries/ugc-net/cbse-ugc-net-december-2014-expected-cut-off-marks-percentage-results

1) Economics – [Gen= 64%] [OBC= 59%] [SC= 54%] [ST= 54%] [PWD= 54%]

2) Political Science – [Gen= 62%] [OBC= 58%] [SC= 53%] [ST= 53%] [PWD= 54%]

3) Philosophy – [Gen= 65%] [OBC= 61%] [SC= 57%] [ST= 56%] [PWD= 56%]

4) Psychology – [Gen= 64%] [OBC= 58%] [SC= 54%] [ST= 55%] [PWD= 55%]

5) Sociology – [Gen= 65%] [OBC= 60%] [SC= 56%] [ST= 56%] [PWD= 55%]

6) History – [Gen= 63%] [OBC= 59%] [SC= 54%] [ST= 54%] [PWD= 56%]

7) Anthropology – [Gen= 65%] [OBC= 60%] [SC= 58%] [ST= 57%] [PWD= 57%]

8) Commerce – [Gen= 62%] [OBC= 57%] [SC= 53%] [ST= 52%] [PWD= 54%]

9) Education – [Gen= 63%] [OBC= 59%] [SC= 55%] [ST= 53%] [PWD= 55%]

10) Social Work – [Gen= 63%] [OBC= 59%] [SC= 56%] [ST= 55%] [PWD= 55%]

11) Defence and Strategic Studies – [Gen= 68%] [OBC= 62%] [SC= 60%] [ST= 59%] [PWD= 56%]

12) Home Science – [Gen= 62%] [OBC= 56%] [SC= 54%] [ST= 54%] [PWD= 53%]

14) Public Administration – [Gen= 65%] [OBC= 61%] [SC= 58%] [ST= 56%] [PWD= 53%]

15) Population Studies – [Gen= 64%] [OBC= 60%] [SC= 55%] [ST= 56%] [PWD= 55%]

16) Music – [Gen= 62%] [OBC= 57%] [SC= 54%] [ST= 51%] [PWD= 54%]

17) Management – [Gen= 63%] [OBC= 58%] [SC= 55%] [ST= 54%] [PWD= 55%]

18) Maithili – [Gen= 73%] [OBC= 64%] [SC= 54%] [ST= 54%] [PWD= 64%]

19) Bengali – [Gen= 61%] [OBC= 57%] [SC= 53%] [ST= 51%] [PWD= 52%]

20) Hindi – [Gen= 67%] [OBC= 62%] [SC= 58%] [ST= 57%] [PWD= 58%]

21) Kannada – [Gen= 67%] [OBC= 63%] [SC= 61%] [ST= 62%] [PWD= 58%]

22) Malayalam – [Gen= 62%] [OBC= 58%] [SC= 56%] [ST= 50%] [PWD= 54%]

23) Odia – [Gen= 67%] [OBC= 63%] [SC= 60%] [ST= 60%] [PWD= 57%]

24) Punjabi – [Gen= 60%] [OBC= 56%] [SC= 52%] [ST= %] [PWD= 53%]

25) Sanskrit – [Gen= 67%] [OBC= 62%] [SC= 58%] [ST= 58%] [PWD= 58%]

26) Tamil – [Gen= 62%] [OBC= 59%] [SC= 56%] [ST= 55%] [PWD= 56%]

27) Telugu – [Gen= 63%] [OBC= 60%] [SC= 56%] [ST= 57%] [PWD= 56%]

28) Urdu – [Gen= 61%] [OBC= 57%] [SC= 51%] [ST= 52%] [PWD= 55%]

29) Arabic – [Gen= 68%] [OBC= 63%] [SC= 50%] [ST= 57%] [PWD= 60%]

30) English – [Gen= 62%] [OBC= 57%] [SC= 53%] [ST= 52%] [PWD= 55%]

31) Linguistics – [Gen= 65%] [OBC= 60%] [SC= 56%] [ST= 55%] [PWD= 53%]

32) Chinese – [Gen= 64%] [OBC= 56%] [SC= 51%] [ST= 55%] [PWD= 51%]

33) Dogri – [Gen= 68%] [OBC= 53%] [SC= 52%] [ST= 48%] [PWD= %]

34) Nepali – [Gen= %] [OBC= 48%] [SC= 42%] [ST= %] [PWD= 45%]

35) Manipuri – [Gen= 63%] [OBC= 53%] [SC= 52%] [ST= 45%] [PWD= 48%]

36) Assamese – [Gen= 63%] [OBC= 59%] [SC= 56%] [ST= 57%] [PWD= 52%]

37) Gujarati – [Gen= 60%] [OBC= 55%] [SC= 54%] [ST= 53%] [PWD= 47%]

38) Marathi – [Gen= 54%] [OBC= 52%] [SC= 50%] [ST= 48%] [PWD= 47%]

39) French – [Gen= 66%] [OBC= 61%] [SC= 54%] [ST= 50%] [PWD= 56%]

40) Spanish – [Gen= 67%] [OBC= 60%] [SC= 51%] [ST= 50%] [PWD= 46%]

41) Russian – [Gen= 69%] [OBC= 66%] [SC= 54%] [ST= 49%] [PWD= %]

42) Persian – [Gen= 67%] [OBC= 62%] [SC= 57%] [ST= 55%] [PWD= 58%]

43) Rajasthani – [Gen= 67%] [OBC= 63%] [SC= 58%] [ST= 58%] [PWD= 57%]

44) German – [Gen= 69%] [OBC= 63%] [SC= 56%] [ST= 52%] [PWD= 49%]

45) Japanese – [Gen= 64%] [OBC= 55%] [SC= 55%] [ST= %] [PWD= %]

46) Adult Education – [Gen= 69%] [OBC= 64%] [SC= 61%] [ST= 63%] [PWD= 62%]

47) Physical Education – [Gen= 63%] [OBC= 58%] [SC= 56%] [ST= 54%] [PWD= 54%]

49) Arab Culture and Islamic Studies – [Gen= 69%] [OBC= 65%] [SC= 52%] [ST= 52%] [PWD= 57%]

50) Indian Culture – [Gen= 70%] [OBC= 65%] [SC= 58%] [ST= 57%] [PWD= 59%]

55) Labour Welfare – [Gen= 64%] [OBC= 59%] [SC= 56%] [ST= 57%] [PWD= 55%]

58) Law – [Gen= 63%] [OBC= 59%] [SC= 55%] [ST= 54%] [PWD= 55%]

59) Library and Information Science – [Gen= 62%] [OBC= 58%] [SC= 54%] [ST= 53%] [PWD= 53%]

60) Buddhist, Jaina, Gandhian and Peace Studies – [Gen= 69%] [OBC= 64%] [SC= 60%] [ST= 62%] [PWD= 57%]

62) Comparative Study of Religions – [Gen= 64%] [OBC= 60%] [SC= 57%] [ST= 56%] [PWD= 55%]

63) Mass Communication and Journalism – [Gen= 58%] [OBC= 54%] [SC= 51%] [ST= 53%] [PWD= 52%]

65) Performing Arts – Dance – [Gen= 63%] [OBC= 59%] [SC= 55%] [ST= 54%] [PWD= 50%]

66) Museology & Conservation – [Gen= 66%] [OBC= 61%] [SC= 54%] [ST= 54%] [PWD= 50%]

67) Archaeology – [Gen= 68%] [OBC= 64%] [SC= 59%] [ST= 59%] [PWD= 55%]

68) Criminology – [Gen= 68%] [OBC= 63%] [SC= 58%] [ST= 56%] [PWD= 57%]

70) Tribal and Regional Language – [Gen= 63%] [OBC= 60%] [SC= 58%] [ST= 58%] [PWD= 56%]

71) Folk Literature – [Gen= 65%] [OBC= 58%] [SC= 52%] [ST= 56%] [PWD= 46%]

72) Comparative Literature – [Gen= 64%] [OBC= 52%] [SC= 46%] [ST= 48%] [PWD= %]

73) Sanskrit Traditional Subjects – [Gen= 62%] [OBC= 57%] [SC= 50%] [ST= 52%] [PWD= 55%]

74) Women Studies ** – [Gen= 65%] [OBC= 60%] [SC= 57%] [ST= 55%] [PWD= 58%]

79) Visual Arts – [Gen= 59%] [OBC= 56%] [SC= 53%] [ST= 52%] [PWD= 52%]

80) Geography – [Gen= 64%] [OBC= 59%] [SC= 55%] [ST= 55%] [PWD= 54%]

81) Social Medicine & Community Health – [Gen= 64%] [OBC= 60%] [SC= 58%] [ST= 54%] [PWD= 55%]

82) Forensic Science – [Gen= 64%] [OBC= 60%] [SC= 57%] [ST= 55%] [PWD= 50%]

83) Pali – [Gen= 70%] [OBC= 67%] [SC= 64%] [ST= 53%] [PWD= 50%]

84) Kashmiri – [Gen= 56%] [OBC= 48%] [SC= %] [ST= %] [PWD= %]

85) Konkani – [Gen= 56%] [OBC= 50%] [SC= 52%] [ST= %] [PWD= %]

87) Computer Science and Applications – [Gen= 60%] [OBC= 55%] [SC= 51%] [ST= 53%] [PWD= 50%]

88) Electronic Science – [Gen= 63%] [OBC= 59%] [SC= 57%] [ST= 56%] [PWD= 57%]

89) Environmental Sciences – [Gen= 60%] [OBC= 56%] [SC= 52%] [ST= 52%] [PWD= 51%]

90) International and Area Studies – [Gen= 65%] [OBC= 62%] [SC= 57%] [ST= 57%] [PWD= 55%]

91) Prakrit – [Gen= 70%] [OBC= 63%] [SC= 52%] [ST= 42%] [PWD= %]

92) Human Rights and Duties – [Gen= 66%] [OBC= 61%] [SC= 57%] [ST= 56%] [PWD= 55%]

93) Tourism Administration and Management – [Gen= 60%] [OBC= 56%] [SC= 53%] [ST= 54%] [PWD= 49%]

94) Bodo – [Gen= 62%] [OBC= %] [SC= 51%] [ST= 58%] [PWD= 55%]

95) Santali – [Gen= 65%] [OBC= 61%] [SC= %] [ST= 60%] [PWD= 57%]

Type the letter of the word or phrase on the right that completes the statements with given option as “descriptor portion, data portion, compilation & execution”.


1. When you submit a DATA step, SAS processes the
step in the __________________ phase first.

2. When you submit a DATA step, SAS processes the
step in the __________________ phase second.

3. During the compilation phase, SAS creates the
_____________ of the output data set.

4. During the execution phase, SAS creates the
_____________ of the output data set.

What does %put do?


Identify statements whose placement in the DATA step is critical.


Is it possible to use the MERGE statement without a BY statement ? Explain?


What does the difference between combining 2 datasets using multiple SET statement and MERGE statement?


The values for the variable Name in the table below are in the form last name, first name. Which WHERE statement will return all the observations that have a first name starting with the letter M for the given values?


9th nov

a. where Name like '_, M_';

b. where Name like '%, M%';

c. where Name like '_, M%';

d. where Name like '%, M_';

%d bloggers like this: