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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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