Hi I'm new to Data Steps because I have always been using Proc Sql instead. This time I just need to look into it and therefore I hope that someone in here are able to help I need to derive words and the first value from a text string / variable in a table. The string contains data that looks something like this: Large text in variable (TXKLIGK): Housing 300.000 310.000 320.000 Car 50.000 51.000 52.000 etc. (100 other posts) Every line is 80 characters and the start of the words are always identical and so is the end of every value. In this Case I need "Housing" and "300.000". I have made some code that through substrings and so on can "cut out" the desired values, so that is ok. My problem is that I need a way to make a list of words (like Housing) to look up within the text string and then loop throuh these words and make a new column for each word, where the header is the "word" I look for and the value is the number: New table: Name Housing Car etc... Thomas 300.000 50.000 etc... I have tried to loop through the array "Values" så I find all the values, but at the same time I need the variable "Value" to change name according to the value in the array, so I can identify the value, but it doesn't seem to work if I e.g. writes value&i = substr(sub, position_var, length); or value&Values(i) = substr(sub, position_var, length); data test1 data test1; set Main; array Values {4} $30. ( "Housing" "Car" "Power" "Tv" ) ; do i=1 to 4; Values_string =''||"/"||Values(i)||"/"||''; position=prxmatch(Values_string, TXLIKG); if position ^= 0 then do; sub = substr(TXLIKG, position, 45); pattern= "([0-9\.\,]+)"; patternID=prxparse(pattern); call prxsubstr(patternID, sub, position_var, length); if position_var ^= 0 then do; value = substr(sub, position_var, length); end; end; end; run; I do hope it makes sense and thank you all in advance for any help. Regards Thomas
... View more