Appropriate Data Analysis

Our story

We are a company established in 1994 to provide statistical services to the pharmaceutical industry. Since then, we have created award-winning statistical models for direct marketing, worked on donor support for a large charity, provided data warehousing solutions in banking and insurance and now, in these challenging times, our primary focus is in supporting the development of medicines for cancer patients.

Our vision remains the same. No nonsense, appropriate data analysis.

The quickest way to count the number of observations in a SAS data step.

data null;

if 0 then set lb.dsname nobs=num;

put "Observations =" num;

stop;

run;

Why is it the quickest?

The if 0 statement prevents execution of the dataset, and so gets the data from the dataset's metadata, specifically its value of nobs.

The stop statement prevents the start of an (endless) loop.

You could instead put it into a macro variable:

data null;

if 0 then set lb.dsname nobs=num;

call symputx('m_nobs',num);

stop;

run;

which creates the macro variable m_nobs.

Nerd's corner

Useful advice of the month for programmers to be changed from time to time
“Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.” - Albert Einstein

Salford Rugby League Football Club

Early 20th Century

Contact us initially:

vincent.jones@redgulldata.net

Powered by Zyro.com