BookmarkSubscribeRSS Feed
Reeza
Super User

@saugatasantra84 wrote:
We cannot increase it? or if we want to rename?

No you cannot increase. Yes you can rename it, but you're still limited to 32 characters.

saugatasantra84
Calcite | Level 5
can you tell me the procedure?
i guess once we have imported the file then how to rename it and use that file ?
Also i was trying to do time series analysis with it but i am unable
to proceed both in seeing the trend also forecasting for the future
please do revert back
Tom
Super User Tom
Super User

@saugatasantra84 wrote:

proc import datafile = "E:\Analytics_Backup_Acche\daily-spot-prices-for-heating-oil-1986-march-2016.csv"
out = mylib.SpotPrices
dbms = dlm
replace;
delimiter = ";";
run;

 

this is running fine but the last column has text exceeding 32 characters hence it is not coming full, so what to do


Why would there be anything to do?  You cannot have a variable name that is longer than 32 characters (and why in the world would you want one?).  Run proc contents and you should see that the original column headers are used as the variable labels.

proc contents data=mylib.SpotPrices;
run;

proc print label data=mylib.SpotPrices;
run;
Tom
Super User Tom
Super User

Why would you ever use PROC IMPORT to read a file with 4 columns?

It is more work to write the PROC IMPORT code than to write the DATA step code.

 

With a DATA step you have complete control over how SAS is reading the data including what variable names to use and what labels to attach to the variables.

 

You data file has the date in three variables. You can combine them to create an actual date variable.

data want ;
  infile 'myfile.csv' dsd dlm=';' firstobs=2 truncover ;
  length Year 8 Month $20 Day 8 FOB 8 ;
  label fob='New York Harbor No. 2 Heating Oil Spot Price FOB (Dollars per Gallon)';
  input year month day fob ;
  date = input(cats(day,substr(month,1,3),year),date9.);
  format date date9.;
run;

 Once you have actual date and value pairs you then use SAS procedures to analyze the data.

proc sort data=want; by date; run;
PROC SGPLOT DATA = Want;
 SERIES X = date Y = fob;
run;

image.png

Reeza
Super User

DBMS =TAB means your delimiter is a tab. 

Since your file is a CSV try DBMS=CSV

ballardw
Super User

Separate what? Into what? Using what rules?

 

And did you read the data with a data step or import using a wizard or proc import code?

 

It may not hurt to post the result of proc contents here as well. That way we will know whether your variable(s) are numeric or character, which may not be obvious pasting values.

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
  • 20 replies
  • 2414 views
  • 0 likes
  • 5 in conversation