## Repeated set of observations for each patient

Solved
Highlighted
Occasional Contributor
Posts: 7

# Repeated set of observations for each patient

I am a relatively new SAS user. I use SAS 9.4. I have 260 patients with their Patient IDs in sequential order from 1 to 260. I would like for each of the patient to have a set of set of repeated observations which I can use for further analysis. However, I am stuck on how to create a set of repeated observations in SAS. I do not want to manually enter the observations for each of the 260 patients.I would really appreciate suggestions. Thanks!

I would like the data set to look like this in the end:

Study_ID         Age_in_Days      Mean_HF

1                              2                     10

1                             15                     42

1                              70                    45

2                           2                          10

2                           15                        42

2                           70                       45

3                            2                          10

3                            15                       42

3                            70                        45

Accepted Solutions
Solution
‎10-06-2017 05:40 PM
Super User
Posts: 21,546

## Re: Repeated set of observations for each patient

That's known as a cross join or cartesian product.

``````proc sql;
create table want as
select *
from table1, table2;
quit;``````

All Replies
Super User
Posts: 21,546

## Re: Repeated set of observations for each patient

And what are you starting with? What are the rules for repeating data? Post sample data.

Occasional Contributor
Posts: 7

## Re: Repeated set of observations for each patient

Hi Reeza,

Below are the two variables and the set of observations that I would like to repeat for each of my patients (From 1 to 260). The first variable is Age_In_Days and the second variable is Mean_HF value.

SAMPLE:

 Age in days Mean Hf 45 75 90 40.4 150 31.8 225 28.1 315 24.6 405 21.8 495 19.5

I just want to create a data set that has these values repeated for each patient to look like this (I only have 3 patients here but I need it similar for all 260 patients):

 1 45 75 1 90 40.4 1 150 31.8 1 225 28.1 1 315 24.6 1 405 21.8 1 495 19.5 2 45 75 2 90 40.4 2 150 31.8 2 225 28.1 2 315 24.6 2 405 21.8 2 495 19.5 3 45 75 3 90 40.4 3 150 31.8 3 225 28.1 3 315 24.6 3 405 21.8 3 495 19.5
Solution
‎10-06-2017 05:40 PM
Super User
Posts: 21,546

## Re: Repeated set of observations for each patient

That's known as a cross join or cartesian product.

``````proc sql;
create table want as
select *
from table1, table2;
quit;``````
Occasional Contributor
Posts: 7

## Re: Repeated set of observations for each patient

Thank you, Reeza.

☑ This topic is solved.