SAS Macro : Determine the number of rows and variables in a dataset

Live Online Training : SAS Programming with 50+ Case Studies

- Explain Programming Concepts in Simple English
- Live Projects
- Scenario Based Questions
- Job Placement Assistance
- Get 20% off till July 14, 2017

Suppose you need to find out the number of rows and number of character and numeric variables in a data set.
data _null_;
if 0 then set correl nobs=n;
array nums _numeric_;
array chars _character_;
nvar = dim(nums);
cvar = dim(chars);
tvar= nvar + cvar;
call symput ('nrows',n);
call symput('numer',nvar);
call symput('chars',cvar);
call symput('totvar',tvar);
run;

%put &nrows;
%put &numer;
%put &chars;
%put &totvar;

In this program, correl is a data set.

SAS Tutorials : 100 Free SAS Tutorials

About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has close to 7 years of experience in data science and predictive modeling. During his tenure, he has worked with global clients in various domains like retail and commercial banking, Telecom, HR and Automotive.


While I love having friends who agree, I only learn from those who don't.

Let's Get Connected: Email | LinkedIn

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "SAS Macro : Determine the number of rows and variables in a dataset"

Post a Comment

Next → ← Prev