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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 754 views
  • 3 likes
  • 2 in conversation