@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 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;
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;
DBMS =TAB means your delimiter is a tab.
Since your file is a CSV try DBMS=CSV
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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.