BookmarkSubscribeRSS Feed
merahilyana
Fluorite | Level 6

i need help??

 

example my value is:

state

kula lumpur

puterajaya

labuan

 

but i want it will be like this:

state

  kula lumpur

      puterajaya

  labuan

8 REPLIES 8
PeterClemmensen
Tourmaline | Level 20

What is the logic here?

merahilyana
Fluorite | Level 6
i want put space before kula lumpur n more space before puterajaya..that all
PeterClemmensen
Tourmaline | Level 20

Why? You just want to put for example two spaces before kula lumpur and four spaces before puterajaya.

merahilyana
Fluorite | Level 6

THAT IS EXAMPLE THE REAL DATA LIKE THIS:
BATU PAHAT
  M.P. Batu Pahat
    Bandar Penggaram

to show result at word like that..

Kurt_Bremser
Super User

What do you mean by "real data"? SAS datasets or external files from which SAS data needs to be created?

Also keep in mind that in many cases, SAS will not display leading blanks per default.

merahilyana
Fluorite | Level 6
MY DATA..NOT FROM SAS..JUST WANT APPEAR RESULT WILL BE LIKE THAT ONLY..
Astounding
PROC Star

If that data is already in a SAS data set, you need to take two steps.

 

First, add leading blanks.  For example:

 

varname = '  ' || varname;

 

Secondly, you need to preserve the leading blanks when displaying the variable.  For example:

 

format varname $char20.;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1977 views
  • 2 likes
  • 4 in conversation