Interview Question: Calculating Sample Stats in SAS

Sample Question #205 (programming – SAS)

Let a be a SAS dataset that’s already read into SAS memory and let v be the numeric variable of interest from a.

How do you get the following sample statistics about v in SAS?

  1. Mean, standard deviation, median, minimum value, maximum value
  2. Kurtosis
  3. Two-sided confidence interval limits, with confidence level (i.e., alpha) set to 15%

(Comment: SAS, which is great for processing large datasets, can be found at many quant shops)

Advertisements
This entry was posted in Sample Qs. Bookmark the permalink.

2 Responses to Interview Question: Calculating Sample Stats in SAS

  1. Brett says:

    ANSWER
     
    You use PROC MEANS for all these sample statistics.  (Bonus question: do you know the difference, in syntax and in functionality, between PROC MEANS and PROC UNIVARIATE? When would you use which?)
     
    1. PROC MEANS DATA=a MEAN STDDEV MEDIAN MIN MAX;
        VAR v;
     
      [Since you’re asked to print sample stats only for the variable v, make sure you include the VAR statement! Remember, quants must be detail-oriented.]
     
    2. PROC MEANS DATA=a KURTOSIS;
        VAR v;
     
    3. PROC MEANS DATA=a ALPHA=.15 CLM;
        VAR v;
     

  2. Brett says:

    This is pretty basic stuff in SAS (beyond using only DATA steps). Not too long ago, though, I interviewed a candidate whose resume labeled him a "SAS expert," yet he couldn’t answer this question correctly (he didn’t know he could specify specific statistics for SAS to compute and print out). [True story]
     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s