Fluorite | Level 6

1. Does anyone know where 1 and 6 came from after YearMon?

Also in this one it said to include commas and zero decimal places how did they decide comma6. and comma10. instead of any other number?

Lastly,

Where am I supposed to be looking for How many storms are in PressureGroup 1?

I did the following but wrote 3118 and it was wrong. Please advice what is correct answer and where you saw it.

data storm_cat;

set pg1.storm_summary; keep Name Basin MinPressure StartDate PressureGroup;

*add ELSE keyword and remove final condition;

if MinPressure=. then PressureGroup=.;

else if MinPressure<=920 then PressureGroup=1;

else PressureGroup=0;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
SAS Super FREQ

Hi:

First, look at the YearMon values, such as with PROC FREQ:

Note that Year is specified in the first 4 positions of the variable and Month value is in positions 6-7, the constant letter M is in position 5. Then, as suggested, review the lecture or read the documentation on the use of the SUBSTR function and the MDY function. Here's the breakdown:

Regarding your second question about "how did they decide" which number to use with the format for comma -- either 6 or 10, that comes down to knowing your data well -- what is the largest possible value, how do you want that value to be displayed, how many extra punctuation characters will be needed to display the largest number. It never hurts to specify a larger value than you think you'll need. Let's say you have a variable called VarX that has a possible minimum value of 3 digits and a possible maximum value of 8 digits. To display the minimum and the maximum using commas as the thousand separator, you need at least 2 commas as shown below:

The largest number that could be displayed without formatting problems is 99999999, which would need a format of comma10. to display as 99,999,999.

Last, 3118 is the total number of rows in the pg1.storm_summary data file. If all the storms were in Pressure Group 1, that would be the right answer. However, there is a procedure which will show you the number of rows that fall into Pressure Group 1 vs Pressure Group 0 or missing. You could either run PROC FREQ on your output data WORK.STORM_CAT or you could run some other procedure. But running PROC FREQ would be the method I would recommend.

Hope this helps point you in the right direction,

Cynthia

3 REPLIES 3

@sann123 wrote:
1. Does anyone know where 1 and 6 came from after YearMon?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
SAS Super FREQ

Hi:

First, look at the YearMon values, such as with PROC FREQ:

Note that Year is specified in the first 4 positions of the variable and Month value is in positions 6-7, the constant letter M is in position 5. Then, as suggested, review the lecture or read the documentation on the use of the SUBSTR function and the MDY function. Here's the breakdown:

Regarding your second question about "how did they decide" which number to use with the format for comma -- either 6 or 10, that comes down to knowing your data well -- what is the largest possible value, how do you want that value to be displayed, how many extra punctuation characters will be needed to display the largest number. It never hurts to specify a larger value than you think you'll need. Let's say you have a variable called VarX that has a possible minimum value of 3 digits and a possible maximum value of 8 digits. To display the minimum and the maximum using commas as the thousand separator, you need at least 2 commas as shown below:

The largest number that could be displayed without formatting problems is 99999999, which would need a format of comma10. to display as 99,999,999.

Last, 3118 is the total number of rows in the pg1.storm_summary data file. If all the storms were in Pressure Group 1, that would be the right answer. However, there is a procedure which will show you the number of rows that fall into Pressure Group 1 vs Pressure Group 0 or missing. You could either run PROC FREQ on your output data WORK.STORM_CAT or you could run some other procedure. But running PROC FREQ would be the method I would recommend.

Hope this helps point you in the right direction,

Cynthia

Fluorite | Level 6