BookmarkSubscribeRSS Feed
tahaahsin
Calcite | Level 5

Hi All,

 

So I'm running a program to inset empty values for all variables except date values between two observations that have a gap in their date interval. For example, an observation that has 1999Q1 and the next one has 2000Q3.

 

Also I want to do this across bygroups in my dataset--I have a set of quarterly observations for a given individual.

 

I'll impute the date that goes missing after "expansion" later, but right now my main concern is getting the additional observations with the missing dates.

 

Thank you for the help and suggestions!

2 REPLIES 2
Jagadishkatam
Amethyst | Level 16
Could you please provide sample data and expected output
Thanks,
Jag
PGStats
Opal | Level 21

Here is how to do this with proc expand:

 

data have;
input id qtr :yyq6. x;
format qtr yyq6.;
datalines;
1 2009Q1 1
1 2009Q3 2
2 2010Q1 3
2 2011Q1 4
2 2011Q2 5
;

proc expand data=have out=want to=qtr method=none;
by id;
id qtr;
run;

proc print data=want noobs; run;
PG

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