BookmarkSubscribeRSS Feed
ASerrato
Calcite | Level 5

Hello! I am very VERY new to SAS and I am stuck in something very basic. I am working with SAS Studio and am trying to get the number of records (n), mean, standard deviation, minimum, and maximum values for each column for a data set. I enter:

 
/* Get descriptive statistics */ 
PROC MEANS DATA=myData; RUN;
 
I run it and it is only giving me the N Obs as a result , what I am doing wrong? 
image.png
7 REPLIES 7
novinosrin
Tourmaline | Level 20
PROC MEANS DATA=myData n min max mean std; 
var _numeric_;
RUN;

 or 

 

PROC MEANS DATA=myData n min max mean std; 
var col1 col2 col3;
RUN;
ASerrato
Calcite | Level 5

Thank you @novinosrin . That makes total sense! But now I got stuck a bit further...

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 PROC MEANS DATA=myData n min max mean std;
74 var _numeric_;
WARNING: No numeric variables found in data set WORK.MYDATA.
75 RUN;
 
ERROR: Statistics requested for printing, but no VAR statement has been specified. No printed output will be produced.
ERROR: Neither the PRINT option nor a valid output statement has been given.
 

 Please help!!!!!!! 

novinosrin
Tourmaline | Level 20

Plz check if you have

1. A dataset by the name mydata

2. if yes, run

proc contents data=mydata;

run;

 

the results should tell you the info about variables in the dataset

3 if the above 2 is fine, run proc means as suggested

ASerrato
Calcite | Level 5

@novinosrin 

I got this.. seems like the type is Char

Alphabetic List of Variables and Attributes# Variable Type Len Format Informat Label21

BChar109$109.$109.B
FRED_Graph_ObservationsChar42$42.$42.FRED Graph Observations

 

But my dataset contains numbers, which is where I need to get the summary statistics from

 

1Federal Reserve Economic Data 
4Economic Research Division 
5Federal Reserve Bank of St. Louis 
6  
7A191RL1Q225SBEAReal Gross Domestic Product, Percent Change from Preceding Period, Quarterly, Seasonally Adjusted Annual Rate
8  
9Frequency: Quarterly 
10observation_dateA191RL1Q225SBEA
1117258-1
1217349-.8
13174416.4
14175336.2
15176246.8
16177152.3
1717807.4
1817899-5.4
1917989-1.4
20180804.2
2118172-3.3
221826416.7
231835412.8
241844516.4
25185377.9
26186295.5
27187197.1
28188108.5
2918902.9
30189944.3
3119085.9
32191762.9
331926813.8
34193607.6
35194503.1
3619541-2.2
3719633-5.9
3819725-1.9
3919815.4
40199064.6
41199988.1
422009011.9
43201806.7
44202715.5
45203632.4
4620455-1.5
47205463.3
4820637-.4
49207296.7
50208212.6
5120911-.9
52210024
5321094-4.1
5421186-10
55212762.7
56213679.6
57214599.7
58215517.9
59216419.3
6021732.3
61218241.1
62219169.3
6322007-2.1
64220982
6522190-5
66222822.7
67223727
68224637.9
69225558.1
70226477.3
71227373.7
72228285
73229201.3
74230124.4
75231024.6
76231939.1
77232852.6
78233778.7
79234684.4
80235596.4
81236511.2
822374310
83238335.1
84239249.2
85240169.5
862410810.1
87241981.4
88242893.4
89243813.3
90244733.6
9124563.2
92246543.8
93247463
94248388.4
95249296.9
96250203.1
97251121.6
98252046.4
99252941.2
100253852.7
 
 
novinosrin
Tourmaline | Level 20

if the values are all numbers but are stored as char, keep it simple as you learn

 

/*convert char to num*/

 

data num_result;

set input_dataset;

num_var1=input(char_var1,8.);

num_var2=input(char_var2,8.);/*and so on*/

run;

Then use the num_result dataset as input in your proc means as discussed previously

 

ASerrato
Calcite | Level 5

Thank you!!

Tom
Super User Tom
Super User

That explains why PROC MEANS was only showing you the number of observations. You need to have numeric variables to be able to calculate statistics like MEAN.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 2754 views
  • 1 like
  • 3 in conversation