Help using Base SAS procedures

Teradata date format in SAS for Passthrough

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

Teradata date format in SAS for Passthrough

Whats the best way to format monthstart and end dates to use in a teradata passthrough query in SAS,

below is a bit of code that formats todays date in to teradata format but not sure who to do the monthstart and monthend in the same format.

any help is appreciated

data _null_;

call symput('yyyymmdd',compress(put((intnx('day',today(),1)-1),yymmdd10.),"-"));

run;

%put &yyyymmdd;

data x;

format yymmdd $7.;

yymmdd = substr(&yyyymmdd.,7,6);

VAR = "1";

New_Date = cat(VAR,yymmdd);

drop yymmdd var;

run;

%global td_dte;

proc sql;

select New_Date into: td_dte

from x;

quit;

%put &td_dte;

proc sql; drop table x; quit;


Accepted Solutions
Solution
‎02-09-2012 10:28 PM
Super User
Posts: 3,102

Teradata date format in SAS for Passthrough

I'm not familiar with Teradata but following your logic how about something like this:

data _null_;

  today = today();

  month_start = intnx('MONTH', today, 0, 'BEGINNING');

  month_end = intnx('MONTH', today, 0, 'END');

  call symput('today', '1' !! put(today, yymmddn6.));

  call symput('month_start', '1' !! put(month_start, yymmddn6.));

  call symput('month_end', '1' !! put(month_end, yymmddn6.));

run;

%put &today &month_start &month_end;

View solution in original post


All Replies
Solution
‎02-09-2012 10:28 PM
Super User
Posts: 3,102

Teradata date format in SAS for Passthrough

I'm not familiar with Teradata but following your logic how about something like this:

data _null_;

  today = today();

  month_start = intnx('MONTH', today, 0, 'BEGINNING');

  month_end = intnx('MONTH', today, 0, 'END');

  call symput('today', '1' !! put(today, yymmddn6.));

  call symput('month_start', '1' !! put(month_start, yymmddn6.));

  call symput('month_end', '1' !! put(month_end, yymmddn6.));

run;

%put &today &month_start &month_end;

Occasional Contributor
Posts: 12

Teradata date format in SAS for Passthrough

Thanks SASKiwi it works, very much appreciated.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 1823 views
  • 0 likes
  • 2 in conversation