BookmarkSubscribeRSS Feed
podarum
Quartz | Level 8

Hi, If anyone knowledgeable in proc expand, plese explain to me.. I have prices by month/year (time-series) of about 500 stores and 5 products... The prices for some stores are missing. So I used proc expand to interpolate and fill in the holes.. after running the proc expand a small number of stores dissapeared.. and now left with 490 stores.. why is this happening?  thanks

6 REPLIES 6
sassharp
Calcite | Level 5
art297
Opal | Level 21

It would help if you provided a small (not the full) dataset and the code you submit that ends up deleting some of your stores.

podarum
Quartz | Level 8

proc expand data=MS.TC_CMA out=MS.TC_CMA_expand to=MONTH;

by Store Product Store_CD City Province;

convert Price counts Index YR_Opt Value DOM / method=JOIN;

id Date; format Date YYMMP7.;

run;

art297
Opal | Level 21

you didn't include any example data that displays the problem

podarum
Quartz | Level 8

The problem is that I have 500 stores and 5 products, so a combo of 2500 time-series models.. but when I try to fill in the gaps using the above 'expand' code, I end up with 490 stores and 5 products..

something like this:

Store      Date              Price              Product

A            2000.01           234                A1

A            2000.02           246                A1

A            2000.03           258                A1

B            2000.01           564                B2

B            2000.02           534                B2

B            2000.03           533                B2

B            2000.01           345                B1

B            2000.02           354                B1

C            2005.03           356                C2

C            2005.04           367                C2

C            2005.05           359                C2

.. and so on.....(there are alos many other variables attached, just didn't specify them down)..

udo_sas
SAS Employee

Hello -

The example code and data you have shared seem not to illustrate the problem you were reporting.

Here is my interpretation of your data and code - everything seems to work as expected.

Thanks,

Udo

data have;

input Store $  Date Price Product $;

informat date yymmn6.;

format date date10.;

datalines;

A  200001           234                A1

A  200002           246                A1

A  200003           258                A1

B  200001           564                B2

B  200002           534                B2

B  200003           533                B2

B  200001           345                B1

B  200002           354                B1

C  200503           356                C2

C  200504           367                C2

C  200505           359                C2

run;

proc sort data=have;by store product;run;

proc expand data=have out=want to=MONTH;

by Store product;

convert Price  / method=JOIN;

id Date;

run;

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
  • 6 replies
  • 1821 views
  • 0 likes
  • 4 in conversation