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

I am trying to write the below code, But the date values are missing in the output Dataset. Please Help

 

 

data global_sales;
informat Order_ID$32. Order_Date ddmmyyyy10. Ship_Date ddmmyyyy10. Customer_ID$32. Country$32. Category$32.; 
input Order_ID$ Order_Date Ship_Date Customer_ID$ Segment$ City$ State$ Country$ Category$ Sales Quantity Discount Profit;
format Order_Date date10. Ship_Date date10. Sales dollar7.2 Profit dollar6.2;
cards;
CA_2014_AB10015140_41954 11-11-2014 13-11-2014 AB_100151402 Consumer Oklahoma Oklahoma United_States Technology 221.98 2 0 62.15
;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

mmddyyyy isn't a valid informat. Try it with the following:

data global_sales;
informat Order_ID $32. Order_Date ddmmyy10. Ship_Date ddmmyy10. Customer_ID $32. Country $32. Category $32.; 
input Order_ID Order_Date Ship_Date Customer_ID Segment $ City $ State $ Country Category Sales Quantity Discount Profit;
format Order_Date date10. Ship_Date date10. Sales dollar7.2 Profit dollar6.2;
cards;
CA_2014_AB10015140_41954 11-11-2014 13-11-2014 AB_100151402 Consumer Oklahoma Oklahoma United_States Technology 221.98 2 0 62.15
;
run;

Art, CEO, AnalystFinder.com

 

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

mmddyyyy isn't a valid informat. Try it with the following:

data global_sales;
informat Order_ID $32. Order_Date ddmmyy10. Ship_Date ddmmyy10. Customer_ID $32. Country $32. Category $32.; 
input Order_ID Order_Date Ship_Date Customer_ID Segment $ City $ State $ Country Category Sales Quantity Discount Profit;
format Order_Date date10. Ship_Date date10. Sales dollar7.2 Profit dollar6.2;
cards;
CA_2014_AB10015140_41954 11-11-2014 13-11-2014 AB_100151402 Consumer Oklahoma Oklahoma United_States Technology 221.98 2 0 62.15
;
run;

Art, CEO, AnalystFinder.com

 

Reeza
Super User

READ YOUR LOG.

The error is actually pretty clear here, I'm highlighting it in Red. If you fix what it says to fix (too many YY in the format name), check the proper format in the guide it works fine.

https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n1o9q2mkgoe...

 

 

327 data global_sales;
328 informat Order_ID$32. Order_Date ddmmyyyy10. Ship_Date
-----------
-----------
48 48
328! ddmmyyyy10. Customer_ID$32. Country$32. Category$32.;
ERROR 48-59: The informat DDMMYYYY was not found or could not be
loaded.

329 input Order_ID$ Order_Date Ship_Date Customer_ID$ Segment$
329! City$ State$ Country$ Category$ Sales Quantity Discount
329! Profit;
330 format Order_Date date10. Ship_Date date10. Sales dollar7.2
330! Profit dollar6.2;
331 cards;

atulsingh
Obsidian | Level 7
Thanks a lot sir..

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 915 views
  • 0 likes
  • 3 in conversation