Hi,
I'm trying to create a CSV file based on a data set where one of the variables is a 16 digits number, but the number is trimmed in the CSV file.
Here is the code I'm using :
data _null_ ;
set frd_tag.fraud_tagging_&start_date1._&end_date1.;
FILE "\\icc-tlv\root\dwh\BOXI\I_SHAARO\fraud_tagging_daily\reports\fraud_tagging_&start_date1._&end_date1..csv" DLM=',' ;
PUT org pan transaction_id1 transaction_id2 fraud_type ;
run ;
The long number variable is "pan".
What can I do to have this variable saved properly?
Thanks,
Sivan.
Did you try to use proc export to make this CSV file ?
I just tried the following code :
proc export data=frd_tag.fraud_tagging_&start_date1._&end_date1.
outfile="\\icc-tlv\root\dwh\BOXI\I_SHAARO\fraud_tagging_daily\reports\fraud_tagging_&start_date1._&end_date1..csv"
dbms=csv
replace
;
run;
I got the same results...
adding a format seems to do the trick.
It works when I put the results in the log, but not when I'm creating a CSV file,
as the following :
data _null_;
*file log dsd;
FILE "\\icc-tlv\root\dwh\BOXI\I_SHAARO\fraud_tagging_daily\reports\fraud_tagging_&start_date1._&end_date1..csv" DLM=',' ;
set class;
put (_all_)(:);
format long 16.;
run;
I'm thinkin' your gonna have to show your result. You sayin' it don't work aint tellin' me nuttin'.
.
The problem happens when I open the CSV file with excel, and the number looks like this :
1.23E+15
I have a technical problem attaching the file here, but I can send it to you by mail if you give me your adress.
Thanks,
Sivan.
It matters HOW you view your CSV file.
Excel will assume a 16 digit number is to be stored as a number and show it in General format (and convert the 16th digit to 0)
So check your CSV file in notepad.
peterC
I have to open it with excel...
Maybe I should have defined my question differently - you can say that I need to export the 16 digit number variable to excel, is it possible?
Thanks,
Sivan
csv format holds not enough information to direct that a 16digit field should be teated as text instead of number.
Either change the number to be preceeded with a blank character other than blank (x'ff' for example)
or the more professional route = change to ODS tagsets.excelxp destination where you cha define the style on proc print var statement demanding TEXT format for the cell.
You might find postings on the ods reporting forum that help. Look for credit card numbers
peterC
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.