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

I have two data sets.  One is automatically generated with a time stamp every second.  The other is field notes of the time where a load is observed to begin, thus establishing a control point.  I want to assign all points after that control point its load number until the next control point.

can anyone suggest a simple way to do this?

in essence I need the following

secondscontrol point load number
125660.
125670.
125680.
1256911
125700.
125710.
125720.
125730.
125740.
125750.
125760.
125770.
125780.
125790.
125800.
125810.
1258212
125830.
125840.
125850.
125860.
125870.
125880.

to become this

secondscontrol point load number
125660.
125670.
125680.
1256911
1257001
1257101
1257201
1257301
1257401
1257501
1257601
1257701
1257801
1257901
1258001
1258101
1258212
1258302
1258402
1258502
1258602
1258702
1258802
1 ACCEPTED SOLUTION

Accepted Solutions
iiibbb
Quartz | Level 8

Aha!

data b (drop=loadx);

     set a;

     retain loadx;

     if not missing(load) then loadx = load;

     load = loadx;

run;

maybe someone can explain what "(drop=loadx)" is doing

that is not my common usage of "retain" which I've always used to reorder columns.

View solution in original post

4 REPLIES 4
Reeza
Super User

retain control_point 0;

if load_number ne . then control_point=load_number;

iiibbb
Quartz | Level 8

And thank you for that as well... I'll try it.

iiibbb
Quartz | Level 8

Aha!

data b (drop=loadx);

     set a;

     retain loadx;

     if not missing(load) then loadx = load;

     load = loadx;

run;

maybe someone can explain what "(drop=loadx)" is doing

that is not my common usage of "retain" which I've always used to reorder columns.

Reeza
Super User

drops it from the final data set.

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

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
  • 4 replies
  • 1354 views
  • 3 likes
  • 2 in conversation