BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
agdato
Calcite | Level 5

Bonjour, 

J'ai un ensemble de données  "cohorte" qui contient une variable 'id_patient' de type alphanumérique $10., avec des identifiants de patients tels que C959D2D ou "6.09E+203".

 

Cependant, à l'origine, "6.09E+203" n'était pas en notation scientifique, mais plutôt sous forme de nombre mathématique normal.

 

Comment puis-je le modifier dans ma table tout en conservant les autres observations avec des lettres intactes ? Mon code est assez long, et ceci est ma table résultante. Je ne suis pas sûre à quel endroit le format a été modifié, donc la solution la plus simple serait de le changer à la fin. Cependant, je ne sais pas comment procéder, pouvez vous m'aider? 
data cohorte;
input id_patient $;
datalines;
6.09E+203
1C50A210
;run;

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Je crois que l'ID "6.09E+203" correspond à un ID original qui avait le malheur de ressembler à un nombre exprimé en notation scientifique et que Excel a automatiquement converti en nombre.

Mais puisque plusieurs IDs, tels que "609E201", "6086E200", "6092E200" ou "60905E199" par exemple, seront convertis dans le même ID "6.09E+203" par Excel, il est impossible de retrouver avec certitude l'ID original.

Il vous faudra donc, comme suggéré ci-haut, remonter à la source pour recouvrer les ID originaux.

PG

View solution in original post

4 REPLIES 4
Oligolas
Barite | Level 11

Hi,

if there is really a SAS format applied on your patient-id then you can remove it at anytime in your dataset with "format id_patient;"

But if your variable is a text as in the example you provide, I see no possibility to display the real original value, using the scientific notation displayed.

You would have to look at your code and remove the format where it is applied.

Generally I consider it a very bad idea to use formats on ID variables.

________________________

- Cheers -

Tom
Super User Tom
Super User

Most likely you read that value as a NUMBER instead of STRING at some point and wrote it back out using BEST format so the long digit string got converted into that string you showed.

 

Perhaps that was because of the use of some guessing tool, like EXCEL or PROC IMPORT, to read the original text.

 

Best is to go back to the step that read the value as if it was a number and replace it with a step that reads the value as text instead.

 

PGStats
Opal | Level 21

Je crois que l'ID "6.09E+203" correspond à un ID original qui avait le malheur de ressembler à un nombre exprimé en notation scientifique et que Excel a automatiquement converti en nombre.

Mais puisque plusieurs IDs, tels que "609E201", "6086E200", "6092E200" ou "60905E199" par exemple, seront convertis dans le même ID "6.09E+203" par Excel, il est impossible de retrouver avec certitude l'ID original.

Il vous faudra donc, comme suggéré ci-haut, remonter à la source pour recouvrer les ID originaux.

PG
agdato
Calcite | Level 5

Yes. It was exactly that! No way to return on the real ID 😞 Thanks a lot !

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 536 views
  • 0 likes
  • 4 in conversation