Search code examples
sascreate-table

change a length format of a column in sas


This is my code:

data want ; 
    input branch_id branch_name $ branch_specification $ bold_type $ bold_score $ ;
    DATALINES ;
    612 NATANYA masham_atirey  masham 1.15
    ;
run ; 

the output for branch_specification is masham_a I wish to longer the lenght.


Solution

  • You could add a length statement under your data statement.

    length branch_specification $15.;
    

    Just keep in mind that the length statement will put your manipulated variable at the front of your data set. You can change the order with a retain statement.

    data want ; 
        retain branch_id branch_name branch_specification;
        length branch_specification $15.;
        input branch_id branch_name $ branch_specification $ bold_type $ bold_score $ ;
        DATALINES ;
        612 NATANYA masham_atirey  masham 1.15
        ;
    run ;