BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
CTurley
Fluorite | Level 6

I am using the following two lines to get beginning and end dates needed for an api request. I have another api request where the time must be included as well. It looks like "2018-04-01T00:00:00-07:00" I do not understand -07:00 at all. But this is what I need.

 

Is there a time format I can use to get this or a way to "text" it in after the date entry in the url string?

 

filename criteo '/opt/sas/data/sasuser/sn161735/criteo.json';

 

data test;

  enddate=today()-1;

  begindate=intnx('qtr',enddate,0,'b');

  token='xx';

  length url $300 ;

  url=quote(cats('https://publishers.criteo.com/api/2.0/stats.json?apitoken=',token

   ,'&begindate=',put(begindate,yymmddd10.)

   ,'&enddate=',put(enddate,yymmddd10.)

   ,'&metrics=Date;TotalImpression;CPM;Revenue;WinRate'

   ),"'");

  call symputx('url',url);

  call symputx('webusername',quote("x"rk));

  call symputx('webpassword',quote("x"));

run;

 

proc http url=&url method="GET" out=criteo

  webusername=&webusername

  webpassword=&webpassword

  AUTH_BASIC

;

run;

 

libname criteo json fileref=criteo;

 

PROC SQL;

   CREATE TABLE CRITEO_DATA AS

   SELECT t1.date,

          t1.totalImpression FORMAT=COMMA9. AS totalImpression,

          t2.value FORMAT=DOLLAR9.2 AS Revenue,

          t3.value FORMAT=DOLLAR6.2 AS CPM

      FROM CRITEO.ROOT t1, CRITEO.REVENUE t2, CRITEO.CPM t3

      WHERE (t1.ordinal_root = t2.ordinal_root AND t1.ordinal_root = t3.ordinal_root);

QUIT;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

That looks like the E8601DX. format. The last bit, -07:00 is your timezone offset.

View solution in original post

1 REPLY 1
ballardw
Super User

That looks like the E8601DX. format. The last bit, -07:00 is your timezone offset.

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 860 views
  • 2 likes
  • 2 in conversation