Search found 4 matches

by Dove05
Thu Dec 19, 2019 6:30 am
Forum: Suggestions and Requests
Topic: Subtraction of panel data with loop
Replies: 5
Views: 22187

Re: Subtraction of panel data with loop

Gareth,
just a note that the modified code you proposed works!
Thank you so much for your help!
by Dove05
Wed Dec 18, 2019 1:42 am
Forum: Suggestions and Requests
Topic: Subtraction of panel data with loop
Replies: 5
Views: 22187

Re: Subtraction of panel data with loop

The modified code [for !i=1 to 4 'loop over the cross-sections %spec = "if @crossid=" + @str(!i) + " and @obsid=3" smpl @all if @crossid=!i and @obsid=2 series loop=@maxsby(JAN, @crossid=!i, @obsid=2) - @maxsby(JAN,@crossid=!i, %spec) 'jan stands for january next] returns only th...
by Dove05
Tue Dec 17, 2019 8:25 am
Forum: Suggestions and Requests
Topic: Subtraction of panel data with loop
Replies: 5
Views: 22187

Re: Subtraction of panel data with loop

Thank you Gareth for the prompt reply. Although I corrected the code as recommended: for !i=1 to 4 'loop over the cross-sections smpl @all if @crossid=!i and @obsid=2 series loop=@maxsby(JAN, @crossid=!i, @obsid=2) - @maxsby(JAN,@crossid=!i, "if @crossid=!i and @obsid=3") 'jan stands for j...
by Dove05
Tue Dec 17, 2019 7:50 am
Forum: Suggestions and Requests
Topic: Subtraction of panel data with loop
Replies: 5
Views: 22187

Subtraction of panel data with loop

Hi, I have a data panel dim (4,3). This is the code I use to subtract obsid=2- obsid=3 in crossid=4 for January: smpl @all if @crossid=4 and @obsid=2 series result=@maxsby(JAN,@crossid=4, @obsid=2) - @maxsby(JAN,@crossid=4,"if @crossid=4 and @obsid=3") I would like to perform the same subt...

Go to advanced search