06-11-2015 06:47 PM
I created a user defined format using proc format.
afetr applying the format a variable and later when exporting the dataset I'm not seeing the values in format there.
TThe values of the variable after applying the format look loke theese
after exporying i see -10 and 20 etc.
how to export without any data loss?
06-11-2015 07:21 PM
could you please let me know how you applied the format , either by format statement or via put function. I believe the issue what you mentioned arises when the format is applied by format statement.
Please try to apply the format by put function to resolve the issue.
06-11-2015 10:21 PM
I defined as follows:
score format diff.;
so when i export dataset, score doesn't show up as whats defined or displayed in the dataset. instead score shows as -10 and 10 etc.
06-11-2015 10:30 PM
Please try to use put function as
Also i guess you have applied the format as
format score diff.;
Now change this to
06-12-2015 10:53 AM
Just to check, do you really mean it looks like that as CSV, i.e. have you opened the file in notepad and looked at the data. I would suggest you are opening the CSV in Excel, which is resolving the equation.
06-12-2015 12:04 AM
To expand, if you export to Excel SAS does not use the formats in the export. There's usually a note in the log to that effect.
Your code has some issues though as your ranges overlap so I'd expect SAS to complain about that, as well as having incorrect format statement.
06-12-2015 02:13 AM
Once you have assigned a format to a variable, the put statement will honor that when outputting to a text file.
Use .csv as the transfer format, as it is easily controllable with a simple text editor.
-> Textuality rules!
(common UNIX adage)