SAS Procedures

Help using Base SAS procedures
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tusher
Calcite | Level 5

To Solop (and others), 

Although it's a  late solution to this specific problem, yet there is a simple solution indeed. First sort the dataset using the sequence variable as your key variable. (not shown in the code).

Let's say your sequence variable is exseq. Then, before your SET statement use a RETAIN statement and use the seq variable as the statement's option.

 

data EX;
retain exseq ; * must retain this variable in order to re-start assigning a new sequence number;
set ex1;
by subject;
if first.subject then exseq = 0;
exseq+1; * this will assign sequential values to exseq variable;
keep subject exseq;  * optional!; 
run;

 

Hiope this helps.

sas-innovate-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 96406 views
  • 3 likes
  • 6 in conversation