- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am completely new to SAS and I am trying to make sense of the following piece of code.
(PUT(TRIM(BFT_TYPE_CODE_VALUE), $CNBS_bft_type.)) as BFT_TYPE_DESCRIPTION
length = 200
format = $200
informat = $200
label = 'BFT_TYPE_DESCRIPTION'
It is the code in brackets that I am trying to understand.
Can somebody explain in English what the code is doing?
Kind Regards
Vinnie
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi and welcome to the SAS communities 🙂
This looks like something from a PROC SQL step.. The code in the brackets
(PUT(TRIM(BFT_TYPE_CODE_VALUE), $CNBS_bft_type.)) as BFT_TYPE_DESCRIPTION
Working our way from the inside out.. The Trim Function removes trailing blanks from the character variable BFT_TYPE_CODE_VALUE. Next, the PUT FUNCTION is used to return the value of the trimmed variable in the format specified by $CNBS_bft_type. This value is assigned to the new variable BFT_TYPE_DESCRIPTION.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi and welcome to the SAS communities 🙂
This looks like something from a PROC SQL step.. The code in the brackets
(PUT(TRIM(BFT_TYPE_CODE_VALUE), $CNBS_bft_type.)) as BFT_TYPE_DESCRIPTION
Working our way from the inside out.. The Trim Function removes trailing blanks from the character variable BFT_TYPE_CODE_VALUE. Next, the PUT FUNCTION is used to return the value of the trimmed variable in the format specified by $CNBS_bft_type. This value is assigned to the new variable BFT_TYPE_DESCRIPTION.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@BigVinnie wrote:
Hello,
I am completely new to SAS and I am trying to make sense of the following piece of code.
(PUT(TRIM(BFT_TYPE_CODE_VALUE), $CNBS_bft_type.)) as BFT_TYPE_DESCRIPTION
length = 200
format = $200
informat = $200
label = 'BFT_TYPE_DESCRIPTION'
It is the code in brackets that I am trying to understand.
Can somebody explain in English what the code is doing?
Kind Regards
Vinnie
Here, you are not using the put statement, but the put function in an SQL select.
The put() function takes the first argument and formats it with the format supplied as the second argument, and delivers the result as a character string.
The trim() function used to prepare the first argument to put() simply removes trailing blanks from a string.
The documentation for SAS data step functions (which can also be used in SAS SQL) is found here (so you can follow Maxim 1).
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your help.