04-08-2018 05:51 AM
Say I have a table containing date variable and I want to recursively referring to taq libraries such as:
data zzz; set taqms.&type._&yyyymmdd; if ('9:35:00't) <= time_m <=('14:35:00't); run;
where &type=ctm and &yyyymmdd is the date variable converted in to the form "yyyymmdd" inside a macro.
But the %let command do not work well with date type variable and I am not able to assign the specific row observation to the &yyyymmdd variable.
For example, the date table:
And I want to recursively referring to taq libraries according to the date values above.
04-08-2018 09:13 AM
SAS date is a numeric variable containing number of days since 01JAN1960.
In order to assign the date in a format of yyyymmdd into a macro variable yyyyyo need to reformat it.
In the table you have a lot of different dates. Which of them you want to assign to the macro variable?
and how did you try to do it?
a singlae date can be assigned to a macro variable, in a sas datastep, using
call symput('macro_var', put(date_var, yymmdd8.);
Better post your full code in oredr to get more accurate answer.
04-08-2018 02:04 PM
Thank you for your response. I would like to assign every date (each at the time, I have a do loop in the macro function) to the macro and perform something like this:
proc sql; create table temp as
select a.*, b.cusip, b.secd
from taqms.&type._&day a, loca2 b
where a.sym_root=b.symbol and (b.sect-&window) <= a.time_m <= (b.sect+&window)
order by b.symbol;
where loca2 is link table for smybol and cusip.