• Visit the 2024 QuantNet ranking of the Best UK Quant MSc Programs.

  • C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

How do you do this in SAS guys?

Joined
7/30/10
Messages
5
Points
11
Hi,

I am experiencing a little problem I cannot resolve myself in Sas,
maybe some of the experts here can help. I don't think its too hard a
problem but I think my knowledge of some SAS functions is limited.
I have such a column:
Indicator
F
F
.
.
M
M
T
T
.
.
W
W
Th
Th
.
.
.
M
M
What I would like is to output only the leading observations. e.g

Indicator
F
F
M
M
W
W
M
M
I would be extremely grateful if someone could help me address this
problem in SAS tremendously.
Thanks
 
Sort by the 'indicator' column. Then, in a data set, do something like:

data data_set_name;
set indicator_data_set_name;
by indicator;
if first.indicator; // this will output the first observation for each sorted set
run;


But it looks like you want the first 2 observations of each sorted set? In that case use a count variable and reset it with first.indicator.
 
Back
Top