10-08-2013 06:29 AM
I have a number of users that have a local install of Base SAS on their machines. They access datasets on a shared drive. The rest of the users use Enterprise Guide. Some of the datasets are created using user defined formats. Enterprise Guide users have no issue accessing these formats but the Base SAS users cannot access them and when opening the dataset using the formats they get the error below. I have tried setting up a library in Base SAS that contains the formats and is loaded at start up but this does not work. What is the best way to set up user formats in Base SAS.
10-08-2013 07:04 AM
The format concept in SAS is extremely well documented.
I suggest that you start in Base SAS documentation, concept guides.
As a quick fix, add -NOFMTERR to the users config files.
10-08-2013 07:57 AM
You also need to add the library to the FMTSEARCH system option so that SAS is looking there for the formats.
Just thinking a bit further:
It appears that you can modify the .cfg and autoexec used by your PC SAS users. I assume as well that the formats accessible by your EG users are stored in a permanent library which gets assigned via Metadata.
2 alternative approaches:
1. If the format catalog is not too big then you could issue a PROC CATALOG in the autoexec which copies the formats from the library the EG users access to the catalog in WORK of the PC SAS users. That's a bit of overhead every single time the users start up PC SAS but it would avoid to assign a library.
2. If most of the libraries the EG users are using point to network drives also accessible by PC SAS users (so: from their workstation) then you could amend the autoexec so that the PC SAS sessions connect to the SAS Metadata Server (options: metaport, metaserver, metauser,....).
You would need to define a new metadata user for PC SAS and then only give read metadata for the libraries accessible from the user's workstation.
Not sure how you implemented the startup of PC SAS. The way I would go is to have an additional autoexec on a network drive accessible both from the Server where EG runs as well as from the workstations where PC SAS runs. I would then define all common settings for EG and PC SAS in this autoexec and %include it into the initial autoexec (and the same also for .cfg). That's then the place where you define stuff like FMTSEARCH and SASAUTOS.
Going down this path would allow you to keep the EG and PC SAS environment as close as possible (so that code becomes "interchangeable") while maintaining the environment centralised.
09-10-2014 11:28 AM
Hi I am new to SAS and just learnt the format and informat function. I have a small query. As we know SAS can read only upto 12 digits by default and greater than 12 digits it will convert it into exponential form. However, if I have to read my credit card number which is 16 digits in length without converting it into exponential form how do I read it or my bank account number which is greater than 12 digits or any large number greater than 12 digits without converting it into exponential form
Need your input
09-12-2014 09:43 AM
Reeza is right.
Although SAS (and most other applications running on Windows or Unix/Linux, that use the IEEE specification of 'real' numbers) can handle up to 15 digit integers, and most 16 digit integers, numbers over 9000000000000000 can suffer from a lack of precision.
Type your credit card number into Excel using a format that displays all the digits and you will see (at least in my version) the final digit converted to a zero (without warning!), which is Excel's way of only showing the digits it can guarantee the accuracy of. I have seen a business process fail because of this happening.
09-12-2014 11:10 AM
Thanks for replying. however, I found a work around for it. You can actually input your 16 digit credit card number into SAS without it converting it into exponential form. In order to read any number greater than 12 digits use informat variablename :range. i.e say informat ccno :30. and to print it say format cc no :30. or you can also use format bestn. where n can be any value greater than 12. For example try executing this program
informat ccno :30.;
Execute it and let me know if it works. Instead of format ccno :30. you can also use format best32.
09-12-2014 10:00 PM
As others already wrote:
- SAS uses 8 bytes for numeric values. This allows you to store 15 digits and most 16 digits strings with full precision. This is the SAS internal storage of numbers.
- Formats are used to print numbers. If you don't explicitly define a format then the default will be used. If you want to print big numbers and this results in scientific notation then use a different format. SAS(R) 9.3 Formats and Informats: Reference
- Informats are used to convert a string to a numeric value. You can convert strings greater than 16 digits but you loose precision. And as SAS even can't store all 16 digits strings with full precision you can already loose precision here. And this means: change the credit card number!
- Only because a string is made up of digits doesn't mean you need to store it in a numeric variable. As a rule of thumb: Store stuff as numeric which is used for calculations, store the rest in character variables. Credit card and bank account numbers are a standard example why one needs to store such data as character and not as numbers.
09-12-2014 11:53 AM
RohanPR With UE you can verify https://support.sas.com/techsup/technote/ts654.pdf the exact number limit is given
The results are obvious
You can read as many digits as you like without getting a warning. It just no the same number anymore.
This document is an oldie. You can also find mainframe having 2-3 bytes with different limits.
numbers well fitting in 3bytes on mainframe are fitting in Windows. This was my experience log time ago (90's) as a regions with four digits where transported and than seen them being wrong collapsed at Windows disappearing some of them. This note did not exist at that time.
43 data abc;
44 input ccno;
45 informat ccno : 30.;
46 format ccno:30.;
47 put ccno ;
Not wat was inputed.
informat ccno : 30.;
put ccno ;
09-13-2014 02:00 AM
It is not only SAS. Some tried to solve this issue by elminiating SAS and using an other tool. Finding the same issue.
Single-precision floating-point format - Wikipedia, the free encyclopedia Should belong to the knowledge of those understand digital age