Hello,
I have this dataset and want to add 0s to before Company if the Company length is less that 6 digits. For example 333 should be 00033, 2 should be 000002, and so on.


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str6 Company  str10 Year
"600104" "2020-12-31"
"600048" "2020-12-31"
"600585" "2020-12-31"
"601628" "2020-12-31"
"601919" "2020-12-31"
"333"    "2020-12-31"
"601601" "2020-12-31"
"600741" "2020-12-31"
"600031" "2020-12-31"
"601668" "2020-12-31"
"601225" "2020-12-31"
"601318" "2020-12-31"
"601898" "2020-12-31"
"600612" "2020-12-31"
"600755" "2020-12-31"
"600998" "2020-12-31"
"601336" "2020-12-31"
"800"    "2020-12-31"
"601888" "2020-12-31"
"688036" "2020-12-31"
"157"    "2020-12-31"
"2311"   "2020-12-31"
"600153" "2020-12-31"
"2493"   "2020-12-31"
"2"      "2020-12-31"
"703"    "2020-12-31"
"858"    "2020-12-31"
"600177" "2020-12-31"
"600803" "2020-12-31"
"538"    "2020-12-31"
"2416"   "2020-12-31"
"601006" "2020-12-31"
"600188" "2020-12-31"
"600346" "2020-12-31"
"601598" "2020-12-31"
"300058" "2020-12-31"
"600248" "2020-12-31"
"601231" "2020-12-31"
"932"    "2020-12-31"
"600383" "2020-12-31"
"906"    "2020-12-31"
"2352"   "2020-12-31"
"601012" "2020-12-31"
"651"    "2020-12-31"
"600023" "2020-12-31"
"425"    "2020-12-31"
"601877" "2020-12-31"
"601155" "2020-12-31"
"600606" "2020-12-31"
"600276" "2020-12-31"
"601899" "2020-12-31"
"603613" "2020-12-31"
"600760" "2020-12-31"
"600887" "2020-12-31"
"601212" "2020-12-31"
"2266"   "2020-12-31"
"600688" "2020-12-31"
"878"    "2020-12-31"
"2726"   "2020-12-31"
"921"    "2020-12-31"
"600966" "2020-12-31"
"338"    "2020-12-31"
"600278" "2020-12-31"
"2241"   "2020-12-31"
"601186" "2020-12-31"
"601138" "2020-12-31"
"300413" "2020-12-31"
"568"    "2020-12-31"
"600057" "2020-12-31"
"603609" "2020-12-31"
"600900" "2020-12-31"
"600282" "2020-12-31"
"300347" "2020-12-31"
"600782" "2020-12-31"
"600050" "2020-12-31"
"600170" "2020-12-31"
"2594"   "2020-12-31"
"2607"   "2020-12-31"
"600742" "2020-12-31"
"300122" "2020-12-31"
"2202"   "2020-12-31"
"600745" "2020-12-31"
"2304"   "2020-12-31"
"600406" "2020-12-31"
"601117" "2020-12-31"
"829"    "2020-12-31"
"603806" "2020-12-31"
"600795" "2020-12-31"
"951"    "2020-12-31"
"2758"   "2020-12-31"
"603882" "2020-12-31"
"2043"   "2020-12-31"
"300772" "2020-12-31"
"601098" "2020-12-31"
"938"    "2020-12-31"
"603225" "2020-12-31"
"600519" "2020-12-31"
"895"    "2020-12-31"
"2242"   "2020-12-31"
"600997" "2020-12-31"
end