No, you don't. The format needs to match how the data is stored. PUT always writes character values.
You can use SUBSTR to read starting from the right and moving to the left.
If the column you are creating is numeric, the storage will default to 8 bytes of floating point notation. If you are creating character data, you should make the length long enough to accommodate the longest name.
If you want just the comma to be the separator, then yes, this syntax will work.
The informat says how you want to read the value that is the first argument in INPUT. The informat has to match how the data is stored. In this situation, we are creating a SAS date, which needs a format to be readable in output.
Leap years are accounted for within these (and other) functions – that’s one of their advantages.
An easy way to remember is PUNCH as a mnemonic - PUT changes numeric to character. PUT always returns a character value; INPUT is the reverse - character to numeric - INPUT is the INverse of PUT. CHIN = character to numeric for input.
The SCAN function can be used when we need to return a word from its relative position. For example, we might want word 1, word 2, etc. The words are delimited by default delimiters or the delimiters of our choice.
Yes, you can think of the FIND function as a more powerful version of the INDEX function. Note that FIND allows us to specify a starting position – gives us more control. The FIND function and the INDEX function both search for substrings of characters in a character string; however, the INDEX function does not have the modifiers nor the starting position arguments as FIND provides.
Yes. You can use the PICTURE statement in PROC FORMAT. Below are some examples:
Thanks for this constructive comment. We added formats for readability. We are revising the materials to better explain both the stored data value as well as a formatted value for purposes of readability.
These kinds of functions - plus many others - conduct transformation work. SAS offers many ETL tools and techniques https://www.sas.com/en_us/solutions/data-management.html
Leading delimiters before the first word in the character string do not effect SCAN. If there are two or more contiguous delimiters, SCAN treats them as one. You can have any number of specified delimiters grouped together, and they are treated as one delimiter.
The answer depends upon how you have specified your delimiters. If your delimiters are blank and comma, then the second word is ‘the’.
If you have a SAS format associated with the date, you should be able to export the file to Excel without modifications. Please see the following:
Yes, <> indicates optional portions of the syntax.
Most SAS functions are available in the SAS implementation of SQL. Please see the following under the heading SAS DATA step functions for high level information about the types of functions supported