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;
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
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
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.
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;
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.
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.