Ch 12 and 20

  1. Which of the statements finishes the code correctly?

    data long_address;
    set student;
    ....
    run;




    C) where lengthn(address)>50;
  2. T/F: In SAS, a variable can be both character and numeric
    False
  3. Which of the statements finishes the code correctly?
    data student_data;
    set student;
    ....
    run;




    A) add_upcase=upcase(address);
  4. T/F: The STRIP function removes leading and trailing blanks
    True
  5. If variables course_subject="BAS" and variable course_num="150" what code correctly creates output of:
    "BAS-150"




    B) catx('-', course_subject, course_num);
  6. If the variable phone contains:

    phone=(919)677-8008
    What is the output of the code
    substr(phone,6,4);




    C) 677-
  7. In the code below, the input function takes a character variable and creates a numeric variable.

    grades=input(old_grades,8.);
    True
  8. The code below creates what type of chart?

    title "Weight v Height";
    proc sgplot data=sashelp.class;
    scatter x=height y=weight;
    yaxis label="Weight in pounds";
    xaxis label="Height in inches";
    run;




    D) Scatter Plot
  9. The code below creates what type of chart?

    title "Hospital B - August 5th";
    proc sgplot data= Blood;
    vbar BloodType;
    xaxis label="Blood Type";
    yaxis label="Patient Counts";
    run;




    B) Vertical Bar Chart
  10. Examine the bar chart below. How many observations from the data set are represented in this chart?
    Image Upload 2




    A) 8
  11. What does the LENGTHN function do in the following code?

    data Long_Names;
    set Sales;
    where lengthn(Name)>12;
    run;
    creates a data set that includes all names that are longer than 12 characters
  12. What does the LOWCASE function do?
    converts all letters to lowercase
  13. What does the UPCASE function do?
    Converts all letters to uppercase
  14. What does the PROPCASE function do?
    Capitalizes the first letter of every "word" and converts the remaining letters to lowercase
  15. What function is used to remove leading and trailing blanks?
    STRIP
  16. Putting strings together is called concatenation, and which SAS function is most used for this function?
    CATX
  17. Which is equivalent to the following code?

    Name= strip(First) || " " || strip(Last_Spaces);




    C) Name= catx(' ', First, Last_Spaces)
  18. How does the SUBSTR (substring) function work?
    specify the string you are searching, the starting position, and the length of the substring

    variable, position start, # of characters
  19. T/F: A variable can be both character and numeric
    False
  20. What is the INPUT function used for?
    changing a character to numeric variable by making a new variable from the old one

    grades=input(old_grades, 8.);
  21. How do you create a vertical barchart with proc sgplot?
    vbar
  22. How do you make a scatter plot with proc sgplot?
    scatter
Author
saucyocelot
ID
358423
Card Set
Ch 12 and 20
Description
Quiz 8 and notes from ppt
Updated