Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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));

asked 27 Jun '12, 10:02

dhruvsingh's gravatar image

dhruvsingh
1112
accept rate: 0%

edited 15 Mar '13, 17:12

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297

1

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

(27 Jun '12, 16:29) Mark Culp
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×3

question asked: 27 Jun '12, 10:02

question was seen: 2,463 times

last updated: 15 Mar '13, 17:12