Dropping created variables from the "current dataset"
Posted: Fri Aug 01, 2014 7:32 am
Hi,
So possibly another strange/terribly ignorant question, but is there a way to drop variables from a set of created data? The code I am using is below.
In short, I have read 14 variables from an excel file into RATS and then created a whole bunch of other variables, most of which I have done so by using loops. There are a few that I do not want to keep, and I tried the DELETE command, but this did not work. I realise this is because it works on saved data files only and my created data is effectively in a "RAM" version of the dataset. Is there a solution that I have missed?
Many thanks.
Regards
Siobhan Redford
So possibly another strange/terribly ignorant question, but is there a way to drop variables from a set of created data? The code I am using is below.
In short, I have read 14 variables from an excel file into RATS and then created a whole bunch of other variables, most of which I have done so by using loops. There are a few that I do not want to keep, and I tried the DELETE command, but this did not work. I realise this is because it works on saved data files only and my created data is effectively in a "RAM" version of the dataset. Is there a solution that I have missed?
Many thanks.
Regards
Siobhan Redford
Code: Select all
OPEN DATA "C:\Users\p174343\PhD\Yield curve\CFS\Monthlydata.xlsx"
CALENDAR(m) 1986:01:31
DATA(FORMAT=XLSX,ORG=COLUMNS) 1986:01:31 2014:06:30 TB3 JAYC1 JAYC2 JAYC3 JAYC4 JAYC5 JAYC6 JAYC7 $
JAYC8 JAYC9 JAYC10 JAYC15 JAYC20 JAYC25
dofor i = TB3 to JAYC25
set %s("D3"+%l(i)) = (i{3})-(i{0})
end dofor i
dofor i = JAYC1 to JAYC25
set %s("D12"+%l(i)) = (i{12})-(i{0})
end dofor i
dofor i = JAYC4 to JAYC20
set %s("D24"+%l(i)) = (i{24})-(i{0})
end dofor i
dofor i = JAYC10 to JAYC25
set %s("D60"+%l(i)) = (i{60})-(i{0})
end dofor i
dofor i = JAYC1 to JAYC25
set %s("S3"+%l(i)) = (i{0})-(TB3{0})
end dofor i
dofor i = JAYC2 to JAYC25
set %s("S12"+%l(i)) = (i{0})-(JAYC1{0})
end dofor i
dofor i = JAYC4 to JAYC20
set %s("S24"+%l(i)) = (i{0})-(JAYC2{0})
end dofor i
delete D24JAYC5 S24JAYC5 D24JAYC7 S24JAYC7 D24JAYC9 S24JAYC9 D24JAYC15 S24JAYC15
dofor i = JAYC10 to JAYC25
set %s("S60"+%l(i)) = (i{0})-(JAYC5{0})
end dofor i