cancel
Showing results for 
Search instead for 
Did you mean: 

Converting SAS code to Sybase SQL

Former Member
0 Kudos
2,599

hi ,

can anybody help me with converting the below code to SQL from SAS ..

I understand that here we have some conversions of the variables into different formats.

but still cannot convert the code ..

please somebody help...

In case some of the code cannot be converted then its fine 🙂 but do provide me what it means if it cannot be converted . Thanks to all who read this and to those who try to reply it 🙂

data params;
length argsep  $ 1;
argsep = ' ';
argvs  = compbl(trim(symget('SYSPARM')));

arg_date = compress(scan(argvs, 1, argsep),'\\.-/ ');
prod_type = compress(scan(argvs, 2, argsep),'\\.-/ ');
dataset_name = compress(scan(argvs, 3, argsep),'\\.-/ ');

rpt_dt = mdy(input(substr(arg_date,5,2),2.), 1, input(substr(arg_date,1,4),4.));

rptmon  = substr(compress(arg_date,'\\.-/ '),1,6);
prptmon = substr(put(intnx('month', rpt_dt, -1, 'b'), yymmddn8.),1,6 );
currmon = substr(put(today(), yymmddn8.),1,6);

wcc_daily_dt = "'"||put (intnx('month', today(), -1, 'b'), yymmdds10.)||"'";
as_of_dt     = "'"||put (rpt_dt, yymmdds10.)||"'";
prev_as_of_dt = "'"||put (intnx('month', rpt_dt, -1, 'b'), yymmdds10.)||"'";
as_of_dt_11mnth = "'"||put (intnx('month', rpt_dt, -11, 'b'), yymmdds10.)||"'";
as_of_dt_12mnth = "'"||put (intnx('month', rpt_dt, -12, 'b'), yymmdds10.)||"'";
as_of_dt_17mnth = "'"||put (intnx('month', rpt_dt, -17, 'b'), yymmdds10.)||"'";
as_of_dt_18mnth = "'"||put (intnx('month', rpt_dt, -18, 'b'), yymmdds10.)||"'";
as_of_dt_19mnth = "'"||put (intnx('month', rpt_dt, -19, 'b'), yymmdds10.)||"'";
as_of_dt_5mnth = "'"||put (intnx('month', rpt_dt, -5, 'b'), yymmdds10.)||"'";
as_of_dt_6mnth = "'"||put (intnx('month', rpt_dt, -6, 'b'), yymmdds10.)||"'";
as_of_dt_7mnth = "'"||put (intnx('month', rpt_dt, -7, 'b'), yymmdds10.)||"'";
as_of_dt_2mnth = "'"||put (intnx('month', rpt_dt, -2, 'b'), yymmdds10.)||"'";
end_dt = "'"||put (intnx('month', rpt_dt, 0, 'e'), yymmdds10.)||"'";

call symput('wcc_daily_dt', trim(wcc_daily_dt));
call symput('prev_as_of_dt',     trim(prev_as_of_dt));
call symput('as_of_dt_11mnth',     trim(as_of_dt_11mnth));
call symput('as_of_dt_12mnth',     trim(as_of_dt_12mnth));
call symput('as_of_dt_17mnth',     trim(as_of_dt_17mnth));
call symput('as_of_dt_18mnth',     trim(as_of_dt_18mnth));
call symput('as_of_dt_19mnth',     trim(as_of_dt_19mnth));
call symput('as_of_dt_5mnth',     trim(as_of_dt_5mnth));
call symput('as_of_dt_6mnth',     trim(as_of_dt_6mnth));
call symput('as_of_dt_7mnth',     trim(as_of_dt_7mnth));
call symput('as_of_dt_2mnth',     trim(as_of_dt_2mnth));
call symput('end_dt',     trim(end_dt));
call symput('as_of_dt',     trim(as_of_dt));
call symput('currmon',      trim(currmon));
call symput('rptmon',       trim(rptmon));
call symput('prptmon',      trim(prptmon));
call symput('prod_type',      trim(prod_type));
call symput('dataset_name',      trim(dataset_name));
MarkCulp
Participant

dhruvsingh: Why did you delete my formatting fixes? ... now the code is almost impossible to read?

Accepted Solutions (0)

Answers (0)