BookmarkSubscribeRSS Feed
pradev
Calcite | Level 5

Hi,

I need help in creating a dummy dataset with days 1-10 and each day with 4 timepoints for each subject. I have to merge this dummy dataset back to the original dataset so that I can get all the missing days and respective timepoints in the original dataset. Can someone help me in creating the dummy dataset with arrays. Dummy dataset should look like below one

subejct day timepoint

10000     1     1

10000     1     2

10000     1     3

10000     1     4

10000     2     1

10000     2     2

10000     2     3

10000     2     4

10000     3     1

10000     3     2

10000     3     3

10000     3     4  and so on

Thanks,

Pradev

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  I'm not sure you need an array. It seems to me a DO loop would be the best way to generate a dummy dataset. Something like what's shown below....it generates one observation for every subject/day/timepoint -- with 4 timepoints and 10 days per subject.

cynthia

data dummydata;

  do subject = 10000 to 15000 by 2500;

    do day = 1 to 10 by 1;

      do timepoint = 1 to 4 by 1;

         output;

      end;

    end;

  end;

run;

        

proc print data=dummydata ;

  var subject day timepoint;

run;

pradev
Calcite | Level 5

Thank you Cynthia. This is exactly what I need.

Regards

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 974 views
  • 0 likes
  • 2 in conversation