Due to audit requirements, need to convert Latin1 encoded files to utf8 however, due to requirements need to preserver time stamp attributes. Is it possible? (source and target both Linux)
Thank you in advance,
S
1) What kind of files you need in utf8 ?
2) Check the documentation about data/file option: encoding='utf8'.
TY for your time. The encoding portion and how to change from latin1 to utf8 at system level and using proc copy is known. The only issue is that there are large # of files that could not have their timestamp attribute change and while doing proc copy with datecopy option is also not saving the original date and time of the file.
@shoin wrote:
TY for your time. The encoding portion and how to change from latin1 to utf8 at system level and using proc copy is known. The only issue is that there are large # of files that could not have their timestamp attribute change and while doing proc copy with datecopy option is also not saving the original date and time of the file.
I understand that you talk about sas datasets.
Please check, does a view satisfy the requirements? so encoding translation is done while reading the original file and the same time saves disk storage.
In case that you must have a copy of the file in different libraries, please check is there a method to do it by linux command.
See for example next link: https://askubuntu.com/questions/1040885/copy-file-and-keep-same-timestamp-of-original-file
@shoin wrote:
TY for your time. The encoding portion and how to change from latin1 to utf8 at system level and using proc copy is known. The only issue is that there are large # of files that could not have their timestamp attribute change and while doing proc copy with datecopy option is also not saving the original date and time of the file.
Pay attention to bold note in PROC COPY documentatiom:
"DATECOPY
DATECOPY can be used only when the resulting SAS file uses the V8 or V9 engine.
If the file that you are copying has attributes that require additional processing, the last modified date is changed to the current date. For example, when you copy a data set that has an index, the index must be rebuilt, and the last modified date changes to the current date. Other attributes that require additional processing and that could affect the last modified date include integrity constraints and a sort indicator."
It seems that altering the encoding, made an aditional process, therefore DATECOPY did not work and you got the current date.
I hoped that view could serve to translate encoding and was disapointed while testing the code, as shown in next link:
You can use the Linux touch command to reset the timestamp to the original value.
Hi, not an efficient solution for a large # of files. TY though.
@shoin wrote:
Hi, not an efficient solution for a large # of files. TY though.
It's as easy to automate as the encoding conversion. Retrieve the date, do the conversion, set the date, all within the same loop.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: