Hi,
data report_week_oct_dec_data;
set report_04_01_2021(In = in1)
report_11_01_2021(In = in2)
report_18_01_2021(rename = (date = chardate))
report_25_01_2021(rename = (date = chardate))
report_28_12_2020(rename = (date = chardate));
if not missing (chardate) then date = input(chardate,yymmdd10.);
if in1 or in2 then date = input(put(date,f8.),yymmdd10.);
format date yymmdd10.;
run;
the datatype of date in the 1st two data sets it is best32. and in the last 3 datasets it char10.
After running this code, the date column is coming blank.
As I have been running the code on VDI, I am not privilleged to copy/snip the log.
However, I am writing the log for this part of code.
Note : Invalid argument to function input at line 476 column 176. In1=1 In2=0 date=. ccsid = 1134567 chardate= _Error_ =1 _N_=20
Please help!
@anandmgjsa wrote:
hi,
data report_week_oct_dec_data;
set report_04_01_2021(In = in1)
report_11_01_2021(In = in2)
report_18_01_2021(rename = (date = chardate))
report_25_01_2021(rename = (date = chardate))
report_28_12_2020(rename = (date = chardate));
if not missing (chardate) then date = input(chardate,yymmdd10.);
if in1 or in2 then date = input(put(date,f8.),yymmdd10.);
format date yymmdd10.;
run;
the datatype of date in the 1st two data sets it is best32. and in the last 3 datasets it char10.
After running this code, the date column is coming blank.
As I have been running the code on VDI, I am not privilleged to copy/snip the log.
However, I am writing the log for this part of code.
Note : Invalid argument to function input at line 476 column 176.
In1=1 In2=0 date=. ccsid = 1134567 chardate= _Error_ =1 _N_=20
Please help!
So you have to 1) type out line 476 from your log.
Since you say the problem is occurring at column 176 and not of the lines you show for code exceed 80 characters or so then your "code" is different.
The issue is you have invalid data: date is missing from your data set indicated by IN1 in this case. If there is nothing in the INPUT data set what do expect for output. You can address that by:
if (in1 or in2) and not missing(date) then date = input(put(date,f8.),yymmdd10.);
But that would only effect one record in the output data set, or any of the records from the contributing data sets. If ALL of the column is blank then I strongly suggest you go back and examine ALL the records of your data sets.
Can you create TEXT files from SAS code? PROC PRINTO will allow you to direct the LOG to a file. The you could attach the text file to a message with actual details.
after that it is written in the log:
chardate =2020-10-22 ccsid = date=2020-10-22
@anandmgjsa wrote:
after that it is written in the log:
chardate =2020-10-22 ccsid = date=2020-10-22
Hens teeth.
Pulling.
One line at at time without much context isn't really helping much.
Look into Proc Printo for creating a text file of what is written to the log. Then attach the generated text file in the forum.
I don't have internet connection in my VDI.
I am just seeing it i typing it in my own environment which has connectivity.
so, I can not send the log.
Please show us the log line 476. THIS IS ESSENTIAL.
And if this is necessary:
date = input(put(date,f8.),yymmdd10.);
then your whole data import process is broken, as date values should have been read as such (and not as 8-digit numbers) in the first place.
If have a strong suspicion that all your woes are caused by the use of PROC IMPORT.
Please let us know how the data arrives in SAS.
I have imported all the excel files from import data option of File in menu bar.
Then, I have triggered "run import data".
I have not used proc iport beacause it's not working in my system due to configuration issues of my SAS EG.
In1=1 In2=0 date=. ccsid = 1134567 chardate= _Error_ =1 _N_=20
This shows us that
Change your statement to
if (in1 or in2) and not missing(date) then date = input(put(date,f8.),yymmdd10.);
Given that you use the import task for Excel files (which is just as bad as using PROC IMPORT, as it also involves guessing by a few grams of silicone, and I sincerely hope that you do not consider that few grams of silicone to be more intelligent than yourself), you will get all kinds of funny artifacts when doing this repeatedly.
I suggest that you
this will give you consistent variable attributes throughout. If you encounter interesting input (like "N/A" for missing numeric values), you can take care of that in the code with custom-made informats.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.