Date: Tue, 14 Aug 2001 01:40:44 -0500
Reply-To: Larry Hai Che <che@OLIN.WUSTL.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Larry Hai Che <che@OLIN.WUSTL.EDU>
Organization: Washington University in St. Louis
Subject: a matrix of price, index and dummy variables
Dear all,
I have a table which looks like this,
ID PRICE UPC
ccyyxxx 0.00 xxx
there are around 23,000 different ID observations, therefore the matrix is
23,000(rows)*3(colmns)
For ID: "cc":city index, "yy": week index and "xxx": upc index.
I need to point out that same UPC(xxx) could correspond to different IDs. I
have here 260 distinct UPC, which corresponds to 23,000 distinct IDs.
I want to further creat a table which adds 260 columns of dummies
corresponding to 260 UPCs, so the whole matrix(table) would be
23,000(rows)*(3+260)(colmns), the headings of the 260 new columns would be
"xxx"(UPC), i.e.,
ID Price UPC 001 002 003
....................................260
c1y1001 0.00 001 1 0 0
0
c2y1001 0.00 001 1 0 0
0
c2y2003 0.00 003 0 0 1
0
................................
I don't know whether this made it clear to you or not. Basically I would
add another 260 columns which are column vectors of dummy variables. For
each row, when UPC=UPCof the column, dummy=1, otherwise dummy=0,
I hope any experts would know how to program this. I appreciate your
helps!!!
Larry
|