@Lauban wrote:
Hi Jagadishkatam, I inputted
data VAT.T_FRMIMMUNEtwo;
set VAT.T_FRMIMMUNE;
datebloodsmeassured=input(compress(calmappeddov,' /'),date9.);
format calmappeddov mmddyy10.;But it did not work. sorry about that.
And did that generate an error? What did the log show?
use date9. informat to read and then use mmddyy10. format
data abc;
a='11/May/2008';
b=input(a,date9.);
format b mmddyy10.;
run;
Hi I received this:WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.
data have;
input date&:$20.;
new=input(compress(date,' /'),date9.);
format new mmddyy10.;
cards;
02 / Nov / 2007
;
Hi Jadagadish thanks for replying. I want to change column a (olddate) which has character variables in the format of 11/May/2008 to a newdate column with the date variable with the format MM/DD/YYYY. Your code does not work for me, but I may have made a mistake .
Hi Jagadishkatam, I inputted
data VAT.T_FRMIMMUNEtwo;
set VAT.T_FRMIMMUNE;
datebloodsmeassured=input(compress(calmappeddov,' /'),date9.);
format calmappeddov mmddyy10.;
But it did not work. sorry about that.
@Lauban wrote:
Hi Jagadishkatam, I inputted
data VAT.T_FRMIMMUNEtwo;
set VAT.T_FRMIMMUNE;
datebloodsmeassured=input(compress(calmappeddov,' /'),date9.);
format calmappeddov mmddyy10.;But it did not work. sorry about that.
And did that generate an error? What did the log show?
Lauban wrote:1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; NOTE: ODS statements in the SAS Studio environment may disable some output features. 62 63 data VAT.T_FRMIMMUNEtwo; 64 set VAT.T_FRMIMMUNE; NOTE: Data file VAT.T_FRMIMMUNE.DATA is in a format that is native to another host, or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce performance. 65 datebloodsmeassured=input(compress(calmappeddov,' /'),date9.); 66 format calmappeddov mmddyy10.; _________ 484 NOTE 484-185: Format $MMDDYY was not found or could not be loaded.
Looks like it worked to me. You just attached the format to the old variable instead of the new one.
Notice the $ that SAS added to the format in the note in the log. That is telling you that the variable you tried to attach the MMDDYY format to was a character varaible instead of numeric variable so SAS kindly decided that meant to attach a character format instead of a numeric format to it, but it couldn't find a character format with that name.
I want to change column a (olddate) which has character variables in the format of 11/May/2008 to a newdate column with the date variable with the format MM/DD/YYYY. Thanks in advance!
Hi @Lauban!
Up to now you have failed to provide example data.
Use the macro provided in https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to convert your dataset to a data step that can be posted here (use the 6th or 7th button on top of the posting window for posting code).
With an exact copy of your data (that's what the macro does), we can give you code that works with it.
Seems like the DATE informat can read those values, as long as you only have 3 characters for the month. Just make sure to use a large enough width. If you have strings longer than three characters for the month name then you will probably want to use the ANDTDTE informat instead.
data _null_;
input string $20. ;
length informat $20 date 8;
do informat='date20.','anydtdte20.';
date=inputn(string,informat);
put informat= date= date9. ;
end;
cards;
02 / Nov / 2007
;
informat=date20. date=02NOV2007 informat=anydtdte20. date=02NOV2007
Not sure why you would want to display using mmddyy format as that is just asking for confusion when trying to communicate with people in the EU. Why not use YYMMDD format instead so that nobody confusing Dec 10th for Oct 12th. or use DATE9 since then the month is displayed using letters so again you cannot get confused about which number is the month and which is the day.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: