It probably would depend on what kind of beer. You could probably live a long time on just water and Guinness, but not very long at all on Natty Light. Either way I think you'd probably be pretty sick of beer within a week or less
With 43 kcal/100ml you need about 4.6 liters or 5 qts to satisfy your caloric needs (2000kcal/day). If you even out the intake over the whole day, alcohol levels should be low enough to keep you functioning. Beer also contains a bit of protein and low levels of sodium, potassium and magnesium.
Long term, you'll get scurvy after a few months due to lack of vitamin C and liver cirrhosis from the sustained alcohol use.
I learned once upon a time that a healthy person needs about three weeks to starve to death if they have water. Not sure how accurate it is as it's part of the rule of three mnemonic; 3 minutes without oxygen, 3 days without water, 3 weeks without food. However, it does at least seem reasonably plausible, so we can use that as a baseline.
Now, beer does have some nutrients, but far from enough of the ones you need. It has to be balanced with water to be able to burn the alcohol without dehydrating yourself. I would therefore think that the beer in moderate amounts might help some, but not a lot. Four weeks total, maybe?
It really depends on your starting weight too. A really obese person with only water and beer could go far longer than 3 weeks, probs 6 months or more. They'd start getting in trouble when they exhausted their fat soluble stores of AEDK.
Protein I think would be the issue. There was a case study on a morbidly obese guy that did this with doctors. What I remember is he basically told his doctor he was going to stop eating entirely. They could either help him and give him medical advice along the way, or try to just advise against and he was going to do it anyways. He would take a daily vitamin for general vitamins and I believe some yeast paste to give him protein. I think the dude lost like 400lbs in a year. Had small bowel movements every 30 to 40 days.
Edit: Apparently it wasn't protein but amino acids.
he consumed only vitamins, electrolytes, an unspecified amount of yeast (a source of all essential amino acids)
Beer is 95% water. If you’re counting on it for all your calories, you probably won’t want to drink any additional water or you lose your precious salt and vitamins.
As others have noted vitamin C and salt are probably the most immediate lacking nutrients. If you had a margarita once a week, I think that might be enough.
Numerous people have done a 40-day fast for lent, taking only beer. So that is easily doable. Multiple months is probably possible, but seasons/years maybe not.
High malt, low alcohol beers could keep a person surviving for a pretty long time. You would likely run into some deficiencies in certain vitamins eventually, but that would take months to be a problem.
Generally there is the rule of three's. Three weeks without food. Three days without water. Three minutes without air. Every one is different and circumstances under any of these conditions may very but it's a good rough timeline.
Beer has caloric value but I'm unsure how long that would keep you going.