- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 08-06-2008 12:14 PM
(992 views)
Hi,
How to do the same thing that below (ie the same column names) with a boucle do?
data final4 (drop=_label_);
set final3;
COL1b=lag(seq1);
COL2b=lag(seq2);
COL3b=lag(seq3);
COL4b=lag(seq4);
COL5b=lag(seq5);
run;
thanks by advance
How to do the same thing that below (ie the same column names) with a boucle do?
data final4 (drop=_label_);
set final3;
COL1b=lag(seq1);
COL2b=lag(seq2);
COL3b=lag(seq3);
COL4b=lag(seq4);
COL5b=lag(seq5);
run;
thanks by advance
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Not totally sure of the question, possibly interested in a SAS coding technique requiring fewer lines to accomplish the objective?
If yes, then using a SAS ARRAY to declare the two sets of SAS variables is a technique I use often when there are repeating variable groups to assign -- sample code below, given the poster's submission:
data final4 (drop=_label_);
set final3;
array acol (*) col1b col2b col3b col4b col5b;
array aseq (*) seq1-seq5;
do i=1 to dim(acol);
acol(i) = lag(aseq(i))
end;
run;
Scott Barry
SBBWorks, Inc.
If yes, then using a SAS ARRAY to declare the two sets of SAS variables is a technique I use often when there are repeating variable groups to assign -- sample code below, given the poster's submission:
data final4 (drop=_label_);
set final3;
array acol (*) col1b col2b col3b col4b col5b;
array aseq (*) seq1-seq5;
do i=1 to dim(acol);
acol(i) = lag(aseq(i))
end;
run;
Scott Barry
SBBWorks, Inc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, it's exactly what i wanted to do.
My programs will looks better!
Cyril
My programs will looks better!
Cyril