BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DoumbiaS
Quartz | Level 8

Hi to all,

Need kind mind about this :

 

Datahave :

input A @@;
cards;
1441.47    1465.15   1441.36   1360.16   1424.37   1387.12   1346.09   1333.36 

 

Datawant :

input A B;
cards;
1441.47 1441.47
1465.15 1465.15
1441.36 1465.15
1360.16 1465.15
1424.37 1465.15
1387.12 1465.15
1346.09 1465.15
1333.36 1465.15

 

Where B is computed as : B= max ($A$1: A_n_) that is most greatest value of A since the first line.

 

Thanks.

B Regards

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

As long as your data set does not yet contain B:

 

data want;

set have;

retain b;

if a > b then b = a;

run;

View solution in original post

3 REPLIES 3
andreas_lds
Jade | Level 19

What have you tried so far?

Posting code using the running-man-icon is recommended to preserve formatting and white-space.

grafik.png

 

You will want to look-up the retain statement.

Astounding
PROC Star

As long as your data set does not yet contain B:

 

data want;

set have;

retain b;

if a > b then b = a;

run;

DoumbiaS
Quartz | Level 8

Thanks for that ! It is a possibility !

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 1290 views
  • 0 likes
  • 3 in conversation