BookmarkSubscribeRSS Feed
zdk
Calcite | Level 5 zdk
Calcite | Level 5

Hello everyone,

    I want to export SAS data to Hive.

    Tpye timestamp in hive is "yyyy-mm-dd hh:mm:ss.sss",but when I used format E8601DTw.d in SAS,it appeared as

"yyyy-mm-ddT hh:mm:ss.sss",how can I deal with it without "T",or do you have other better solutions?

    I really appreciate for your help.

 

3 REPLIES 3
LinusH
Tourmaline | Level 20

It sounds like you are using a STRING column in Hive.

If you are on .12 or higher, this is not the recommended approach.

Use a TIMESTAMP data type instead, and SAS/ACCESS should be able to map it, thus no need to specify a SAS ISO datetime format.

 

"Highlighting New Hive .12 Data Types

This chapter presents considerations for sharing data between Hive and SAS. For example, you need to know how to identify the Hive STRING columns that contain DATE, TIME, or TIMESTAMP information. You also need to know how to minimize the length of SAS character columns that are created from Hive STRING columns. Where you use the VARCHAR, DATE, and TIMESTAMP data types that are available in Hive .12 and later, you optimize sharing data between Hive and SAS. For example, the SASFMT table properties that are described later are not needed for Hive columns that are declared VARCHAR, DATE, and TIMESTAMP."
Data never sleeps
ed_sas_member
Meteorite | Level 14

Hi @zdk 

Maybe you could try to use a picture format:

proc format;
picture myfmt (default = 50) low-high='%Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime);
run;
yabwon
Onyx | Level 15

Hi,

 

Maybe your own format:

proc format; 
  picture myTimestamp (default=19)
          other='%Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime);
run;


data test;
  a = datetime();
  format a myTimestamp.;
run;
proc print;
run;

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



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 choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 2905 views
  • 1 like
  • 4 in conversation