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

Hello team,

 

I have two datasets. One has a variable with character datatype as d123.22, the second dataset has a variable with character datatype as d12322. I need to make them consistent to be able to join them through this field. How can I reach there?

 

Regards,

BlueBlue

Blue Blue
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Let's face it: English is the lingua franca of computing. Developers (especially across different native languages) use English as their common idiom. All (almost, I am talking about those used world-wide) programming languages are based on English (ALGOL, COBOL, FORTRAN, BASIC, PASCAL, C, PL/1, SQL, VBA, Python, Go, Rust, .....).

 

Documentation is written in English first, translations are added as an afterthought, and sometimes the translation makes it even harder to understand or ends up being plainly wrong (that's why I also prefer to read the English manuals first for devices I buy, because they are often better and more accurate than the German ones).

 

Therefore, to become versed in "computer English" is a must for every aspiring computer user who wants to go beyond the pointy-clicky helpers that are designed to take language mostly out of the process. Acquiring a sense for everyday English on the side is a benefit that helps in getting around the world. I have yet to find a place where English would not at least help in getting along.

View solution in original post

16 REPLIES 16
Reeza
Super User

Clarify your question first. 

 

By 'datatype' do you mean that's an example of a value stored in the variable?

 

What EXACTLY are the proc contents output in terms of format and type

 


@GN0001 wrote:

Hello team,

 

I have two datasets. One has a variable with character datatype as d123.22, the second dataset has a variable with character datatype as d12322. I need to make them consistent to be able to join them through this field. How can I reach there?

 

Regards,

BlueBlue


 

GN0001
Barite | Level 11

Hello team,

 

Please disregard datatype. 

We have two data types in SAS: character and number

Here what I need is to make these two look same:

v123.12  and v12312

 

I need the second one look like first one.

 

Respectfully,

BlueBlue

 

 

Blue Blue
Reeza
Super User

Both of those must be character if the V is in there. Please confirm this is correct.

 


@GN0001 wrote:

Hello team,

 

Please disregard datatype. 

We have two data types in SAS: character and number

Here what I need is to make these two look same:

v123.12  and v12312

 

I need the second one look like first one.

 

Respectfully,

BlueBlue

 

 


Reeza_0-1642629266770.png

 

GN0001
Barite | Level 11

Hello Reza,

Thanks for your response!

 

I have no idea what "." in compress(field,' . '); do.

I know only compress function remove between leading ending spaces. 

Also, I am curious as why you have used: upcase.

 

Regards,

blueblue

Blue Blue
Reeza
Super User

@GN0001 wrote:

 

I know only compress function remove between leading ending spaces. 

 


COMPRESS Function

Returns a character string with specified characters removed from the original string.

 

Please read the documentation first. 

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.h...

 

COMPRESS(source ,characters> ,< modifier(s)>)

characters

specifies a character constant, variable, or expression that initializes a list of characters.

By default, the characters in this list are removed from the source argument. If you specify the K modifier in the third argument, only the characters in this list are kept in the result.

 


@GN0001 wrote:

Hello Reza,

Thanks for your response!

 

I have no idea what "." in compress(field,' . '); do.

I know only compress function remove between leading ending spaces. 

Also, I am curious as why you have used: upcase.

 

Regards,

blueblue


 

GN0001
Barite | Level 11

Hello Reza,

I can't understand this part:

By default, the characters in this list are removed from the source argument.

 

----------------------

Regarding this example:

data _null_;

x='123–4567–8901 B 234–5678–9012 c';

y=compress(x, 'ABCD', 'l'); put y=; run;

What does 'ABCD' do? What does 'I' do?

Regards,

Blue Blue

Blue Blue
Reeza
Super User
Post the output as well.
Reeza
Super User
Is English your second language? If so, what is your first? The documentation is available in more than one language.
GN0001
Barite | Level 11

Hello Reza,

 

Believe me I couldn't understand it first. Now, I understand it. I think that I was not able to understand it in my first language (Turkish).

I read documentation several times. I couldn't understand what it says until I came to the forum.

Is it ok to ask forum members what our first language is in this forum?

I have to understand it in English to be able to express it in English to my boss.

 

Thanks

BlueBlue

 

 

Blue Blue
Reeza
Super User



@GN0001 wrote:

 

Is it ok to ask forum members what our first language is in this forum?

I have to understand it in English to be able to express it in English to my boss.

 

Thanks

BlueBlue

 

 


I'm not aware of any rules that say it's not ok to ask if English is the first language. As you've probably noticed, there are several languages on here, it's not solely an English forum. 

https://communities.sas.com/t5/SAS-Tech-Tip/SAS-활용-노하우-MONOTONIC-function-in-PROC-SQL/ta-p/781620

 

 

 

GN0001
Barite | Level 11
Hello Reza,
Thanks for ongoing support.

Many things are not rules but we know that if we bring them up, it hurts.
Often the times, I look for something and I can’t understand it from documentations because I am at work and deadlines are getting approached, I am under pressure and finally it is hard to understand!!!!

Respectfully,
Guity

Blue Blue
Tom
Super User Tom
Super User

The point was to see if there was a better way for you understand since SAS does publish documentation in multiple languages.

 

Reading about computer languages in any human language is difficult. Sometimes the words used in computer programming look like words in English (or some other language) but they actual have specific specialized meaning in computer programming in general and in SAS syntax in particular.

 

Plus when reading the documentation it is important to make the connection between the name the documentation uses for an argument to a function (the arguments to a function are the inputs to the function) because in the explanation they will reference those argument names.  So yet another layer of meaning on common words that gives them special meaning within the context of reading the documentation.

 

For example in the COMPRESS() function documentation they use the words SOURCE, CHARACTERS and MODIFIERS to be the names of the three arguments to the function.

 

Syntax

COMPRESS( source <, characters> <, modifier(s)>)
Kurt_Bremser
Super User

Let's face it: English is the lingua franca of computing. Developers (especially across different native languages) use English as their common idiom. All (almost, I am talking about those used world-wide) programming languages are based on English (ALGOL, COBOL, FORTRAN, BASIC, PASCAL, C, PL/1, SQL, VBA, Python, Go, Rust, .....).

 

Documentation is written in English first, translations are added as an afterthought, and sometimes the translation makes it even harder to understand or ends up being plainly wrong (that's why I also prefer to read the English manuals first for devices I buy, because they are often better and more accurate than the German ones).

 

Therefore, to become versed in "computer English" is a must for every aspiring computer user who wants to go beyond the pointy-clicky helpers that are designed to take language mostly out of the process. Acquiring a sense for everyday English on the side is a benefit that helps in getting around the world. I have yet to find a place where English would not at least help in getting along.

GN0001
Barite | Level 11
Hello,
I do whatever I can't remove dot. I looked into the code that you sent
code2 = compress(code, '.');
run;
the dot is till in the string.
This is what I have G34.z or z123.22.
Regards,
Blue & Blue
Blue Blue

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 16 replies
  • 822 views
  • 6 likes
  • 4 in conversation