@Mscarboncopy wrote:
I transformed VAR1 that is being collected as character into numeric to solve my issue with leading spaces for the code you suggested I use for the merge/re-coding of the var ID.
This is fake data I am entering, the data is coming from a REDCap form that is being exported as a SAS file. I use the SAS files to run through my code (The two files I mentioned before set 1 and set 2). I did not enter the values in datalines.
In the code you suggested I use, you mentioned something about a possible issue coming from a number that is too long?
Could that have been it?
You should not see issues with dealing with integer values of that length with SAS. Not sure a about what REDCAP is doing internally or how they attempt to convert what they have internally into SAS datasets. Perhaps the field length in REDCAP is limited in some way causing some truncation? Perhaps REDCAP's idea of how to convert what they have into SAS datasets is flawed?
Look at the values for the two observations that you think should match before your attempt to convert them on the SAS side into numbers. To really see what character variables have use the $HEX format. That will display each byte as two hexadecimal digits. A space will be show as hex code 20. The digits will be hexcodes 30 to 39. Any other hexcodes will cause trouble.
You can get some "rounding" if you where to write out that number using SAS's BEST format without enough characters to represent all of the value. To get only one digit you would have to use BEST3. format, which would result in displaying 7E8 which when converted back into a number would become 7 with 8 zeros.
22 data test;
23 string='657,899,654';
24 number1=input(string,comma32.);
25 string2=put(number1,best3.);
26 number2=input(string2,32.);
27 put (_all_) (=/);
28 run;
string=657,899,654
number1=657899654
string2=7E8
number2=700000000
... View more